Atmosphere / atmosphere-javascript

atmosphere-javascript
Apache License 2.0
122 stars 98 forks source link

Unsubscribe from single subsocket? #262

Open thw0rted opened 4 years ago

thw0rted commented 4 years ago

In the docs, the unsubscribe method is a top level function that, as far as I can tell, closes all known connections to all servers at once. I don't see any method on AtmosphereRequest ("subsocket" in the example) that would allow me to stop the subscription for a single topic. Is this not possible?

ronnybremer commented 2 years ago

You can call unsubscribeUrl() and pass in the URL you connected to. If they are separate for each socket, it only closes that one socket.

thw0rted commented 2 years ago

Thanks Ronny. Is that method described anywhere in the docs? I don't see it but maybe I'm looking in the wrong place.

ronnybremer commented 2 years ago

To be honest, I am not sure. I was debugging an issue in our code where two sockets are used on the same page and discovered that call inside of the JS file. It seems to work and is public, so I hope its an official API...

jfarcand commented 2 years ago

Yes it is. The documentation needs to be updated....unfortunately I don't have time those days, but if you have the cycle, I can review and merge :-)