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
REST - Channels & publishing messages #45
Conversation
180d083
to
13f828b
Compare
13f828b
to
3e49eec
Compare
d0e2dc5
to
382baf0
Compare
add tests for extras argument on message and PresenceMessage
cmd: `flutter create -a java -i objc .`
and generate platform constants
Other changes: - use generated constants over hardcoded strings
I ran `flutter pub get` from repository root. I also had to run `flutter but get` from the `test_integration` folder. We should have done this as part of the last release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the size of this pull request it's been impossible for me to go through every line at the level of detail I would ideally like to, but I've been able to spend enough time to get a reasonably good idea of what's changed.
Some changes needed, please.
Co-authored-by: Quintin Willison <q@qwuk.net>
Co-authored-by: Quintin Willison <q@qwuk.net>
- http package API changes
dart's @Protected is only an annotation and not a keyword. It only provides better hinting, and doesn't enforce/show errors compile time. So it isn't propagated to it's implementation.
d552f09
to
5dc16a3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've not gone through line by line, though I have checked the commits you've submitted since my last review in order to resolve those conversations.
The main
branch was out of date so I've boshed GitHub's update button, resolving that with the merge commit that is fa34b43.
Once checks pass then I'm happy to land this.
not supporting list anymore
extras doesn't support list type anymore
Following conditions picked from Ruby Spec and IDL, as acceptance criteria for this PR:
Channels spec and Channels object spec: IDL | Ruby Spec | Ruby Spec - 1
Channels
is a collection ofChannel
objects accessible throughRest#channels
Channel
instance if available, otherwise create one. This should work similar to the get function as per RSN3a, but withoutChannelOptions
.Channels#get
function:Channel
object for the specified channel if none exists, or returns the existing channel.ChannelOptions
can be provided in an optional second argumentChannels#get(channel, options)
will update the options on the channel and then return the existing Channel object. (Note that this is soft-deprecated and may be removed in a future release, so should not be implemented in new client libraries. The supported way to update a set ofChannelOptions
isChannel#setOptions
-- Totally depends onably-java
andably-cocoa
)Channels#release
function:release()
with a channel name that does not correspond to an extant channel entity must return without error#publish
method of Channel spec : IDL | Ruby SpecMessage.clientId
must be left alone (that is, it will be there if it was set in theMessage
object passed topublish()
, else left unset). The client library must not try and set it from the client-library-wide clientId; that is achieved byRSA7e
for basic auth or implicit in the credentials for token auth. The following tests can be used to check for correct clientId handling:Message
with noclientId
when theclientId
is set to some value in the client options should result in a message received with theclientId
property set to that valueMessage
with aclientId
set to the same value as theclientId
in the client options should result in a message received with theclientId
property set to that valueMessage
with aclientId
set to a value from an unidentified client (noclientId
in the client options and credentials that can assume anyclientId
) should result in a message received with theclientId
property set to that valueMessage
with aclientId
set to a different value from theclientId
in the client options should result in a message being rejected by the server.(RSL1h) The(applicable for platform)publish(name, data)
form should not take any additional arguments. If a client library has supported additional arguments to the(name, data)
form (e.g. separate arguments for clientId and extras, or a single attributes argument) in any 1.x version, it should continue to do so until version 2.0.message
or (if publishing an array) messages, calculated per TO3l8, exceeds themaxMessageSize
, then the client library should reject the publish and indicate an error with code40009
(RSL1j) When(applicable for platform)Message
objects are provided, any validMessage
attribute (that is, an attribute specified in TM2) that is supplied by the caller must be included in the encoded message. (This does not mean it must be included unaltered; for example the data and encoding will be subject to processing per RSL4)40160
. as per https://github.com/ably/ably-common/blob/main/protocol/errors.json )Message object spec : IDL | Ruby Spec
Attributes in message:
#id
retrieves attribute :id#name
retrieves attribute :name#client_id
retrieves attribute :client_id#data
retrieves attribute :data#encoding
retrieves attribute :encoding==
- is true when attributes are the same, is false when attributes are not the same, is false when class type differs#timestamp
retrieves timestamp as DateTime object#extras
(#TM2i) Can benull
,map
, orlist
. Should throw exception or not allow syntactically to pass string or number, or any other types.#connection_id
can benull
or astring
Message object can be initialized with:
name
as "<String input>" (defined above), ornull
but other types are not allowedclient_id
as "<String input>" (defined above), ornull
but other types are not allowedencoding
as "<String input>" (defined above), ornull
but other types are not allowedChannel object spec: Ruby Spec
channel name
argument inconstructor
null
, or any other typename
argument of#publish
int
or any other types is not permitted