-
Notifications
You must be signed in to change notification settings - Fork 16
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
Realtime Channel attach, detach and state events #20
Conversation
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 done a first sweep - there's sure to be stuff I've overlooked but I think there's enough feedback here to keep you busy with some improvements that'll make the code easier to read. Please, please, please default to using final
/ const
wherever possible - in particular final
for Java object references and const
for Objective-C object pointers. They make your intent clear, in particular within the busier methods and functions where local variable intent, purpose and mutability is not always clear.
android/src/main/java/io/ably/flutter/plugin/AblyEventStreamHandler.java
Outdated
Show resolved
Hide resolved
android/src/main/java/io/ably/flutter/plugin/AblyEventStreamHandler.java
Outdated
Show resolved
Hide resolved
android/src/main/java/io/ably/flutter/plugin/AblyFlutterMessage.java
Outdated
Show resolved
Hide resolved
android/src/main/java/io/ably/flutter/plugin/generated/PlatformConstants.java
Outdated
Show resolved
Hide resolved
ConnectionStateChange.current is set as RealtimeConnection~state as soon as event is received before giving it back to source listeners.
1. Channel can be created by passing just the name or both name and channel options 2. As de-registering just requires getting hold of a channel name, options is not used in onCancel method on platform side 3. Example updated with API Support: Android ✓ iOS ✓
…ptions 1. `attachRealtimeChannel` - to attach to a channel 2. `detachRealtimeChannel` - to detach from a channel 3. `setRealtimeChannelOptions` - to update channel options
1. Returning proper message for errors reg. "onRealtimeChannelStateChanged" 2. ChannelStateChange errorInfo decoding handled properly
1. attach and detach use completion listeners/callbacks 2. setOptions is supported only on android side as cocoa doesn't have that API yet (may be 🤔) Android RealtimeChannelStateChange listener implemented Support: Android ✓ iOS ✓
Enable "close connection", "Attach to channel" and "Detach from channel" Dispose listeners on widget dispose.
Remove unwanted comments, delays Added necessary comments and print logs in example
Channel options support is completely removed from dart side, but the methods are retained on Android/iOS side as to support at later point in time.
Create an inline listener and update the connection and channel state property respectively
bb9f4f5
to
f7bf23f
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.
A few suggestions
Realtime Channel API enhancement
Realtime
'sChannelStateChange
event listenerattach
anddetach
implemented on aRealtimeChannel
setOptions
method is updated to throw an exception, asChannelOptions
are not supported in current PROther (non-API) enhancements
EventChannel
for listening to platform events. That payload can be passed as anAblyEventMessage
. This is similar to AblyMessage except that it carries aneventName
attributes instead of ahandleId
attachRealtimeChannel
,detachRealtimeChannel
,setRealtimeChannelOptions