Hello i am building a Rails app and i am working on an actioncable.I have a problem regarding the recieve Method from my channel.Im working on windows via wsl and got redis instead of async.My actioncable is registered and has a connection. It is transmitting the subscription confirmation and streaming to my channel. When i want to send data, i lose the connection and my console.log in thedisconnected() method gets called and I dont receive any data. I get the information via my browser console that the connection is lost.Anyone can give me some insight, what i can to fix that problem?
def create @message = Message.new(message_params) @message.user = current_user @message.save ActionCable.server.broadcast("room_channel_#{@message.room_id}", {message: "hello"} end
room_channel.rb
class RoomChannel < ApplicationCable::Channel def subscribed stream_from "room_channel_#{params[:room_id]}" end def unsubscribed # Any cleanup needed when channel is unsubscribed endendimport consumer from "./consumer"consumer.subscriptions.create({channel: "RoomChannel", room_id: 5}, { connected() { console.log("connected.... HELLO") }, disconnected() { console.log() console.log("disconnected") }, received(data) { console.log(data) }});
In the browser console i recieve the message "disconnect" when clicking a button to send data and i am using gem devise with warden_hooks.rb