Skip to content

unsubscribe channel not working in socketcluster #24

@niraj1991

Description

@niraj1991

Hi,
@sacOO7

Unsubscribe channel not working on socketcluster.

I have to subscribe 20 channel. Now I want unsubscribe 10 channel. So We are use below code for subscribe.

//  For subscribe 
SoketManager.client.subscribeAck(channelName:"random") { (str, obj1, obj2) in
        print ("Got data for channel", str)
 }

//  Listening to channel                 
SoketManager.client.onChannel(channelName:"random", ack: {
         (channelName : String , data : AnyObject?) in
      print ("Got data for channel", channelName, " object data is ", data ?? "")
 })

We are use below code for unsubscribe.

//  For unsubscribe 
 SoketManager.client.unsubscribeAck(channelName:"random", ack : {
       (channelName : String, error : AnyObject?, data : AnyObject?) in
          if (error is NSNull) {
                        print("Successfully unsubscribed to channel ", channelName)
           } else {
                        print("Got error while unsubscribing ", error ?? "")
          }
 })

When I am call "unsubscribeAck" method always get error. Here is error.

{
    message = "Failed to unsubscribe socket from the [object Object] channel - Socket YFaGYE5Tbu1_8we2AAAG tried to unsubscribe from an invalid channel name";
    name = BrokerError;
}

Also I am trying with socketcluster demo as well but It not working for me.
Github link: https://github.com/sacOO7/socketcluster-client-swift

Appreciate your help.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions