Actioncable consumer usage

Viewed 48

I'm having some trouble figuring out what counts as a consumer in actioncable.

Step 1: in my frontend I'm calling:

ActionCable.createConsumer(`/cable`)

This will setup a persistent connection to the actioncable server I'm running.

Step 2: I need to "subscribe" to a given channel.

 <ActionCableConsumer
    channel='WorkspaceChannel'
    onConnected={this.onActionCableConnected}
    onDisconnected={this.onActionCableDisconnected}
    onReceived={this.onActionCableReceived}
    subscriptionHandler={this.actionCableSubscriptionHandler}
  >

My question here is:

If I subscribe multiple times to the same channel from different components in my react application. Will it consume more memory by doing so for a single user?

or

Is the actioncable library handling this for me? Where it knows its already subscribed and its just going to delegate the message to the correct handlers?

0 Answers
Related