0

In my Rails view I call turbo_stream_from view helper to establish turbo stream web socket connection:

<%= turbo_stream_from :my_broadcast %>

Is there a way for know when the web socket connection was established using JavaScript in the browser? Does @hotwired/turbo-rails JavaScript library allow to submit a callback that will be called when the WebSocket is established?

Evgenii
  • 36,389
  • 27
  • 134
  • 170

1 Answers1

0

The connected attribute is added to the <turbo-cable-stream-source> HTML element when connection is established. See https://github.com/hotwired/turbo-rails/pull/430 and https://github.com/hotwired/turbo-rails/issues/434.

Evgenii
  • 36,389
  • 27
  • 134
  • 170