Skip to content

Commit b59ea60

Browse files
committed
[ECO-5426][ECO-5439] Integrate live objects with realtime channel system
- Enhanced ChannelBase to support live objects functionality with seamless integration - Updated live objects protocol message handling in channel pipeline - Improved channel state integration for live objects synchronization - Established robust integration between channels and live objects with proper lifecycle
1 parent 56021a6 commit b59ea60

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

lib/src/main/java/io/ably/lib/realtime/ChannelBase.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,15 @@ private void setState(ChannelState newState, ErrorInfo reason, boolean resumed,
145145
this.reason = stateChange.reason;
146146
}
147147

148+
// cover states other than attached, ChannelState.attached already covered in setAttached
149+
if (liveObjectsPlugin != null && newState!= ChannelState.attached) {
150+
try {
151+
liveObjectsPlugin.handleStateChange(name, newState, false);
152+
} catch (Throwable t) {
153+
Log.e(TAG, "Unexpected exception in LiveObjectsPlugin.handle", t);
154+
}
155+
}
156+
148157
if (newState != ChannelState.attaching && newState != ChannelState.suspended) {
149158
this.retryAttempt = 0;
150159
}
@@ -439,6 +448,13 @@ private void setAttached(ProtocolMessage message) {
439448
}
440449
return;
441450
}
451+
if (liveObjectsPlugin != null) {
452+
try {
453+
liveObjectsPlugin.handleStateChange(name, ChannelState.attached, message.hasFlag(Flag.has_objects));
454+
} catch (Throwable t) {
455+
Log.e(TAG, "Unexpected exception in LiveObjectsPlugin.handle", t);
456+
}
457+
}
442458
if(state == ChannelState.attached) {
443459
Log.v(TAG, String.format(Locale.ROOT, "Server initiated attach for channel %s", name));
444460
if (!message.hasFlag(Flag.resumed)) { // RTL12

0 commit comments

Comments
 (0)