Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions lib/action_cable.dart
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,26 @@ class ActionCable {
case 'ping':
// rails sends epoch as seconds not miliseconds
_lastPing =
DateTime.fromMillisecondsSinceEpoch(payload['message'] * 1000);
DateTime.now();
break;
case 'welcome':
if (onConnected != null) {
onConnected!();
}
break;
case 'disconnect':
final channelId = parseChannelId(payload['identifier']);
final onDisconnected = _onChannelDisconnectedCallbacks[channelId];
if (onDisconnected != null) {
onDisconnected();
final identifier = payload['identifier'];
if (identifier != null) {
final channelId = parseChannelId(payload['identifier']);
final onDisconnected = _onChannelDisconnectedCallbacks[channelId];
if (onDisconnected != null) {
onDisconnected();
}
} else {
final reason = payload['reason'];
if (reason != null && reason == 'unauthorized') {
if (this.onCannotConnect != null) this.onCannotConnect!();
}
}
break;
case 'confirm_subscription':
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: action_cable
version: 1.2.0
version: 1.2.1
description: >-
ActionCable client port in dart, available in web, dartVM and flutter.
homepage: https://github.com/namiwang/actioncable_dart
Expand Down