You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consequently, the diff events do not always get sent to the onSync callback, which is a problem because I end up having inconsistent list of users when I test...
For example backend side:
def handle_info(%Phoenix.Socket.Broadcast{topic: topic, event: "presence_diff", payload: payload}, socket) do
push(socket, "presence_diff", payload)
{:noreply, socket}
end
if (inPendingSyncState) {
pendingDiffs.add(diff);
}
I don't really understand what that test if for but what I tried is to move the lift up the setting of the channelRef
void _onMessage(Message message) {
_joinRef = channel.joinRef;
// Processing of 'state' events.
if (message.event.value == stateEventName) {
final newState = _decodeStateFromPayload(message.payload!);
state = _syncState(state, newState);
for (final diff in pendingDiffs) {
state = _syncDiff(state, diff);
}
pendingDiffs = [];
onSync();
// Processing of 'diff' events.
} else if (message.event.value == diffEventName) {
// added line
_joinRef = channel.joinRef;
final diff = _decodeDiffFromPayload(message.payload!);
if (inPendingSyncState) {
pendingDiffs.add(diff);
} else {
state = _syncDiff(state, diff);
onSync();
}
}
}
Doing so I get all diff updates correctly sent to presence.onMessage callback
The text was updated successfully, but these errors were encountered:
Hello,
I'm not sure whether this is a bug or not but this line https://github.com/braverhealth/phoenix-socket-dart/blob/master/lib/src/presence.dart#L123
only sets channelRef for "presence_state" events
Presence.dart
Consequently, the diff events do not always get sent to the
onSync
callback, which is a problem because I end up having inconsistent list of users when I test...For example backend side:
I don't really understand what that test if for but what I tried is to move the lift up the setting of the channelRef
Doing so I get all diff updates correctly sent to
presence.onMessage
callbackThe text was updated successfully, but these errors were encountered: