RCTWebRTCDemo icon indicating copy to clipboard operation
RCTWebRTCDemo copied to clipboard

How to leave or disconnect the room?

Open bacancy-swaroopa opened this issue 6 years ago • 2 comments

Hi,

I am using this module for video calling and in my screen the video is connect and have a back button in that.

So, I want when click on back button I showed an alert like are you sure you want to leave so when user clicks leave then I want to leave the room and disconnect from socket I kept the following code Alert.alert( 'Fanler', 'Are you sure you want to leave the page?', [ {text: 'No', onPress: () => console.log('Cancel Pressed'), style: 'cancel'}, {text: 'Yes', onPress: () => { alert('socketId'+this.state.socketId); socket.on('leave', function(socketId){ leave(this.state.socketId); }); }}, ], { cancelable: false } )

Expected behavior the user has to leave the room and disconnect from socket

Observerd behavior so when click on that no action is getting performed and leave method is not at all calling. So can u tell me how to leave the room and disconnect when clicking on back button?

Platform information in both iOS and android

React Native version: ^0.43.3 Plugin version:^1.63.0

bacancy-swaroopa avatar Jun 27 '18 03:06 bacancy-swaroopa

I'm facing a similar issue. Need to understand how we can call socket.diconnect() or do we need to emit a disconnect event. I've tried both but it doesn't seem to be working?

shreyas-algo avatar Nov 17 '18 22:11 shreyas-algo

这个demo你们都可以运行起来吗?为什么我一直报错

YuePing1104 avatar Jan 07 '19 09:01 YuePing1104