webcom-components/reach

unSubscribe

Closed this issue · 4 comments

In old sdk, there was Room.unSubscribe, in new Reach there is no Room.unSubscribe.
what is the alternative ?? i tried using stream.unSubscribe but it returns error: "streamData.unSubscribe(...).then is not a function" .

There's is no unSubscribe method on the Room since it is a stream related method.

To stop your subscription to some Remote stream, use the unSubscribe method on the Remote stream object.

remoteStream.unSubscribe()

To unsubscribe from all Remote stream in a Room:

myRoom.remoteStreams().then(remotes => remotes.map(remote => remote.unSubscribe())

To stop publishing your own stream, use the close method of your Local stream object:

localStream.close()

To stop publishing all your streams:

myRoom.localStreams().then(locals => locals.map(local => local.close())

All of this is done when you leave the Room:

myRoom.leave();

The leave method will also change your status within the Room from CONNECTED to WAS_CONNECTED

remote.unSubscribe() return error : "streamData.unSubscribe(...).then is not a function"

unSubscribe is not returning a Promise.

Need to fix Remote.unSubscribe, Local.close to return a Promise

yes, it is :)