ably / ably-ruby

Ruby client library SDK for Ably realtime messaging service
https://ably.com/download
Apache License 2.0
35 stars 19 forks source link

Implement missing presence spec + refactor presence #407

Open sacOO7 opened 3 months ago

sacOO7 commented 3 months ago

┆Issue is synchronized with this Jira Task by Unito

sacOO7 commented 3 months ago
sacOO7 commented 3 months ago
  1. Refactor Presence onMessage/ onSyncMessage implementation like => https://github.com/ably/ably-go/blob/dd8236fc301eb078803e83efee7615f3ba133341/ably/realtime_presence.go#L291
  2. Refactor should_update_member check while adding or removing member from the map =>https://github.com/ably/ably-ruby/blob/062d98f98d4c67a7423ad7a4bb5856b3621e4f71/lib/ably/realtime/presence/members_map.rb#L395. It's not implemented as per RTP2b, RTP2c. There seems to be a bug introduced where member is not added when no existing member is found.
  3. Remove use of _syncSessionId. Currently, it's being used for marking members as updated. ( doesn't go as per spec ). We don't have syncSessionId in any other SDK's, seems this is there since very old spec.
  4. Implement presence code with respect to ably-go implementation => https://github.com/ably/ably-go/blob/main/ably/realtime_presence.go
sacOO7 commented 3 months ago

Remove use of client initiated sync -> https://github.com/ably/ably-ruby/blob/062d98f98d4c67a7423ad7a4bb5856b3621e4f71/lib/ably/realtime/presence/members_map.rb#L292. This method is only needed as a part of testing and client never initiates a sync as per spec.

sacOO7 commented 3 months ago

Update missing connectionId, timestamp and id for inner messages / presence messages based on parent protocol message same as => https://github.com/ably/ably-go/blob/dd8236fc301eb078803e83efee7615f3ba133341/ably/proto_message.go#L60