webRTC-io / webRTC.io

An abstraction layer for webRTC. Aim is to simplify the HTML5 web standard webRTC in a similar manner to socket.io w/ websockets. Highly experimental technology
1.6k stars 293 forks source link

How to stop all connections #36

Open VGubarev opened 11 years ago

VGubarev commented 11 years ago

Hi, guys! I've got a problem. WebRTC.io have API for create connections, but how i can stop all connections and go out from room without restart page? I have tried do this: [js] rtc.closeStreams = function() { rtc.fire('disconnect stream', rtc._me); for (id in rtc.peerConnections) { if (typeof(rtc.peerConnections[id]) !== 'undefined') { rtc.peerConnections[id].close(); } delete rtc.peerConnections[id]; delete rtc.dataChannels[id]; delete rtc.connections[id]; } }; [/js] Yea, it closes all inner streams and stop camera, but server didn't sends to all other participants of room "remove peer connection".

How i can close all streams and alert clients that one of them go out from room ( without page restart)?