1 year ago

#389204

test-img

John

Can't connect to actioncable socket and no error and rejection - what can I do?

Some users are unable to connect to my socket and I have no idea why. I don't see any errors but I do see that they never actually connect. What can be the cause of this and what should I do? I am using Rails actioncable.

I see this is called and the room id is present.

window.subscription_channel = consumer.subscriptions.create({channel: "RoomChannel",room: $("[data-room-id]").data("room-id")},
{
  connected: this._connected.bind(this),
  disconnected: this._disconnected.bind(this),
  received: this._received.bind(this),
  rejected: this._rejected.bind(this)
}
);

And once it connects I set a variable

_connected() {
  window.socket_has_connected_to_room = true
  console.log("connected to room via action cable socket")
}

I do a check after 15 seconds and see the window.socket_has_connected_to_room variable is not true and can see the subscription_channel is present and can verify window.subscription_channel.consumer.connection.disconnected is true. What can I do in this scenario?

ruby-on-rails

websocket

actioncable

0 Answers

Your Answer

Accepted video resources