I only allow authorized users to connect ActionCable, if the user is unauthorized I call reject_unauthorized_connection from Rails.
This sends a response
{
"type": "disconnect",
"reason": "unauthorized",
"reconnect": false
}
This package will crash on line 127 in action_cable.dart:
final channelId = parseChannelId(payload['identifier']);
Because there is no identifier as we are not yet connected to a channel and a channel disconnect callback wouldn't be appropriate anyways since it's disconnecting the client.
We need to check if reason is 'unauthorized' and then call either onConnectionLost or onCannotConnect. I think onCannotConnect would be most appropriate, perhaps even passing the reconnect: false so we know not to retry the connection.
Let me know if you want to make this change or if I should just fork.
I only allow authorized users to connect ActionCable, if the user is unauthorized I call reject_unauthorized_connection from Rails.
This sends a response
{
"type": "disconnect",
"reason": "unauthorized",
"reconnect": false
}
This package will crash on line 127 in action_cable.dart:
final channelId = parseChannelId(payload['identifier']);
Because there is no identifier as we are not yet connected to a channel and a channel disconnect callback wouldn't be appropriate anyways since it's disconnecting the client.
We need to check if reason is 'unauthorized' and then call either onConnectionLost or onCannotConnect. I think onCannotConnect would be most appropriate, perhaps even passing the reconnect: false so we know not to retry the connection.
Let me know if you want to make this change or if I should just fork.