Rails action cable build connection by specific channel id

I need to achieve the function like this scenario.

User will click some button, and it will return some subscribe id.

Then this user will subscribe by this subscribe id.

Here is my javascript code.

<script type="text/javascript">
  $(function() {


  function buildConnection(subscribe_id){
    var channelName = "WebNotificationsChannel_" + subscribe_id;

    App.web_notifications = App.cable.subscriptions.create(channelName, {
        return console.log('connected');

      disconnected() {
        return console.log('disconnected');

      received(data) {
        return console.log('received');

But it seems not connected to the id which I specify. When I type ActionCable.server.broadcast('WebNotificationsChannel_4', message: '<p>Hello World!</p>'). It return []