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

TM3 #309

Merged
merged 13 commits into from Apr 7, 2019
Merged

TM3 #309

merged 13 commits into from Apr 7, 2019

Conversation

withakay
Copy link
Contributor

@withakay withakay commented Mar 16, 2019

Message.FromEncoded and Message.FromEncodedArray

Adding this required quite a bit of refactoring as the message encoders were instanced with in the MessageHandler class and that was initialised with the AblyRealtime instance so I had to move something things around to make it work with the static methods. In addition to enabling the new methods to be added more easily I think the design is simpler now (and thus better).

The tests that I have added are based on those in the Ruby lib.

  • (TM3) fromEncoded and fromEncodedArray are alternative constructors that take an (already deserialized) Message-like object (or array of such objects), and optionally a channelOptions, and return a Message (or array of such Messages) that's decoded and decrypted as specified in RSL6, using the cipher in the channelOptions if the message is encrypted, with any residual transforms (ones that the library cannot decode or decrypt) left in the encoding property per RSL6b. This is intended for users receiving messages other than from a REST or Realtime channel (for example, from a queue), to avoid them having to parse the encoding string themselves.

Copy link
Member

@paddybyers paddybyers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but we do also have some fixture data for testing encoding generally - do your tests already use that?

https://github.com/ably/ably-common/blob/master/test-resources/messages-encoding.json

@withakay
Copy link
Contributor Author

withakay commented Apr 7, 2019

@paddybyers

I don't think I have written test that use that explicitly, but I know there are existing tests (two for RSL6a1, for example) that do make use of it and other data from the ably-common repository.

@withakay withakay merged commit dc055f4 into RTL15 Apr 7, 2019
@withakay withakay deleted the TM3 branch April 7, 2019 14:11
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.

None yet

2 participants