oney / RCTWebRTCDemo

MIT License
215 stars 142 forks source link

How to leave or disconnect the room? #66

Open bacancy-swaroopa opened 6 years ago

bacancy-swaroopa commented 6 years ago

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

shreyas-algo commented 5 years ago

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?

YuePing1104 commented 5 years ago

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