Unsubscribe from stream-room-messages


#1

I’ve trying to unsubscribe from channels without success on the App that I’m working on.
Basically I call a subscription like this:

{
  "msg": "sub",
  "name": "stream-room-messages",
  "params": [
    "ktGEyfXtSdJMW2wLF",
    false
  ],
  "id": "ddp-reactnative-5"
}

And then I receive a reply like this:

{
  "msg": "ready",
  "subs": [
    "ddp-reactnative-5"
  ]
}

When the user moves to a different screen on the App, I call unsubscribe like this:

{
  "msg": "nosub",
  "id": "ddp-reactnative-5"
}

But all I receive is this:

{
  "msg": "nosub",
  "id": "ddp-reactnative-5"
}

What am I doing wrong? I tried the versions 0.65.2, 0.66.0 and 0.62.2 but none of them work. Am I missing something?


#2

I have the same issue! Please can someone help? 2 weeks trying solve it…


#3

that response looks ok… Are you just not happy with the reply, or are you still receiving events from that stream after unsubscribing?


#4

I expected to receive a “msg”: “unsub” instead of “nosub”
And yes, I keep getting the events after this.


#5

I think this is because streams are not normal subscriptions.

unsubscribing with streams may actually not be possible.

This is the package behind: https://github.com/RocketChat/meteor-streamer


#6

@aaron.ogle So is this linked to https://github.com/RocketChat/meteor-streamer/issues/3 ?


#7

Looks like that’s exactly the same issue you are coming across


#8

But according to that issue, seems that streams can be removed by calling “stop()”.
Does this mean that Rocket Chat could have something on the unsubscribe method to invoke “stop” when referring a stream @aaron.ogle? Or is it definitely not possible?


#9

I would ask in that issue and ask how one would stop the subscription over websocket/DDP or if its not possible.


#10

Thanks @aaron.ogle. I just asked that. Will wait for some input :slight_smile: