muaz-khan / WebRTC-Experiment

WebRTC, WebRTC and WebRTC. Everything here is all about WebRTC!!
https://www.webrtc-experiment.com/
MIT License
11.75k stars 3.95k forks source link

socket.io signaler: memory problem when using namespaces #160

Open Ijatsu opened 10 years ago

Ijatsu commented 10 years ago

Hi!

The example of signaler you provide uses connections to namespaces.

The problem with namespaces is that they aren't made to be created dynamically because they are never cleaned. ( 1 million connection = 500mo~ in RAM ) In a long term deployment this could causes many problems. There's a tool for dynamic room: https://github.com/LearnBoost/socket.io/wiki/Rooms

It is done to be used dynamically and is cleaned when no users is connected to.

I tried to make a new signaler with this logic, the problem is that now RTCMultiConnection doesn't work with it, because it uses different connections and "connect" event firing to work but I didn't manage to understand how it establish connections and how it manages its logic.

Do you have a signaler using room logic and an openSignalingChannel function that could work together? Or maybe a way to clean these namespaces ? Or maybe you could explain me the workflow so I could fix it by myself and give my results. :3

muaz-khan commented 10 years ago

Check source code of MultiRTC:

  1. https://github.com/muaz-khan/WebRTC-Experiment/blob/master/MultiRTC/signaler.js#L25
  2. https://github.com/muaz-khan/WebRTC-Experiment/blob/master/MultiRTC/public/ui.peer-connection.js#L51

Relevant documents:

  1. https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Signaling.md
  2. https://www.webrtc-experiment.com/docs/WebRTC-Signaling-Concepts.html#xhr
  3. http://www.rtcmulticonnection.org/docs/openSignalingChannel/

You can use signalmaster or any other signaling implementation along with RTCMultiConnection or all other experiments and libraries.

muaz-khan commented 10 years ago

v1.6 works with all old and new implementations. You can try following:

https://www.npmjs.org/package/socketio-over-nodejs

It is using latest file: http://www.rtcmulticonnection.org/latest.js

After installation; open following URL: http://localhost:8888/RTCMultiConnection

BTW, if you open openSignalingChannel method's document; you can see that old implementations are also listed: http://www.rtcmulticonnection.org/docs/openSignalingChannel/

Ijatsu commented 10 years ago

Sorry it was a mistake from me ^^' i suppressed the message.

I'll read your documents and try to make it work with socket.io room tool