Send ActionCable broadcast from javascript
In the tutorials here, I've seen an ActionCable broadcast be initiated by a chat message save. The broadcast is sent via a relay to a background job and then the chatmessages on the clients update when that broadcast job is run.
In my app, i have a host that runs a chatroom. I'd like the host to click a button and have that button run a javascript command to tell ActionCable to send the "disable-chat" command to the clients that are in the host's chat. I know how the clients receive that message thru ActionCable but how can the host send that request. There is no database save going on and no form to submit.
I imagine in javascript on the hosts page there is something like . chat_consumer.send('chatroom.disable'); or something like that, without doing a form that submits the requests. How do I go about this? Thx