Search code examples
angularjspubnub

Error in PubNub Angularjs, channel group


I've followed this DOCUMENT to working with PubNub Angularjs, channel group. But I got this error:

enter image description here

Here's my code:

Pubnub.init({
  publish_key: constants.PUBNUB_PUBLISH_KEY,
  subscribe_key: constants.PUBNUB_SUBSCRIBE_KEY,
  uuid: $scope.user.IncubatorContactId + "_Layout",
  error: function(error) {
    console.log('Pubnub.init() Error:', error);
  }
});

Pubnub.channel_group_add_channel({
  callback: function(m) {
    console.log('channel_group_add_channel', 'success', m);
  },
  channel: channels[0],
  channel_group: $scope.user.IncubatorContactId
});

Someone please help me!


Solution

  • I found it, channel_group should be string instead of number:

    channel_group: "" + $scope.user.IncubatorContactId + ""