Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Message interactions #1785

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

Message interactions #1785

wants to merge 8 commits into from

Conversation

AndyTWF
Copy link

@AndyTWF AndyTWF commented Jul 20, 2023

This change implements the "subscription" aspect of the message interactions feature.

JIRA links:

Spec points:

  • RTL22
  • MFI1
  • MFI2

It contains the following changes:

  • Introduction of the "MessageFilter" class as per MFI1/2. This allows the user to create and customise the filters they wish to apply to messages. The implementation is aimed to be idiomatic to how ClientOptions is instantiated in the library.
  • Introduction of a class (MessageExtrasFilter) that is responsible for applying the above filter settings given a message.
  • A manager class for MessageListeners that are "filtered" by the client - for management of listeners separate to the main channel object.
  • Addition of additional subscribe and unsubscribe overloads to RealtimeChannel to provide the necessary methods for users to use the new filters, as per RTL22.
  • README examples of publishing and subscribing to message interactions.

To test:

  • Create an instance of ARTMessageFilter and specify whatever filters you'd like to use
  • Subscribe to a channel with that filter
  • Publish messages to the channel that match your filter, they should be received by your subscriber
  • Publish messages to the channel that do not match your filter, they should not be received by the connection (ie onMessage will be called), but not passed on to your subscriber.

Filters that can be tested:

  • Whether the event "name" matches that of the filter
  • Whether the publishing "clientId" matches that of the filter
  • Whether (or not) the message references another
  • Whether the referenced message timeserial matches the filter
  • Whether the reference type matches the filter

Other implementations for reference:

ably/ably-js#1003
ably/ably-java#966

Similar to the ably-java implementation of the same class, checks the message
extras and a few other fields on the message to check that they match the user-provided
filter.

This class will be used as part of a message filterer to implement filtered message
interactions.
@github-actions github-actions bot temporarily deployed to staging/pull/1785/features July 20, 2023 20:08 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/1785/jazzydoc July 20, 2023 20:15 Inactive
Rather than manage filtered listeners directly in the channel class, which makes it awkward to test
in isolation, the ARTFilteredListeners class separates out this behaviour.

Also adds a filtered listener class that applies the filter before calling the
listener.
This change implements the message interactions specification RTL22 for the ARTRealtimeChannel class.

Includes a method to subscribe a listener with a filter as well as one to remove listeners based on the
filter they have associated with them (if at all).
@github-actions github-actions bot temporarily deployed to staging/pull/1785/features July 21, 2023 17:50 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/1785/jazzydoc July 21, 2023 17:55 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant