Websocket Channel - help in app architecture


I want to implement websocket for several uses in my app:

  • Chat between users. chat:userid
  • inform connected users : active-sockects
  • Send Notifications for users of various types. : notifications
  • Internal forum: forum
  • any other idea may come along.

In order to have the code more organized I want to implement a channel for each one of this concepts. So when the user logs in will connect to 3-5 channels.

I’m using this approach because the information is different.

Is this the right approach or it will demand too much resources from the server, client and connection?

The alternative is to implement less channels and to manage all the message in the controller.

Thanks for your help.

1 Like

Opening websocket channels doesn’t consume resources, you could have thousand of channels open at any time and nothing would happen, the payload that is sent through the channels is consuming resources, so if the application doesn’t have many concurrent users and messages sent at the same time you shouldn’t botter about how many channels you have created.

1 Like