ably-java
ably-java copied to clipboard
Message interactions
This change implements the "subscription" aspect of the message interactions feature.
JIRA links:
- Epic: https://ably.atlassian.net/browse/CON-6
- Story: https://ably.atlassian.net/browse/CON-2
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
ClientOptionsis 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
subscribeandunsubscribeoverloads to ChannelBase 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
MessageFilterand 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
JS implementation for reference:
https://github.com/ably/ably-js/pull/1003
Popped this back to draft for a second as I'm investigating a potential issue