Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTCMultiConnection can not signaling with socket.io over node.js example code #54

Closed
notedit opened this issue Jun 26, 2013 · 6 comments

Comments

@notedit
Copy link

notedit commented Jun 26, 2013

i do not if i did it wrong.

if test this demo https://webrtc-experiment.appspot.com/RTCMultiConnection/video-conferencing/ with custom signaling.

the client code is

openSignalingChannel: function(config) {
   URL = 'http://localhost:8888/';
   channel = config.channel || this.channel || 'Default-Socket';
   sender = Math.round(Math.random() * 60535) + 5000;

   io.connect(URL).emit('new-channel', {
      channel: channel,
      sender : sender
   });

   socket = io.connect(URL + channel);
   socket.channel = channel;

   socket.on('connect', function () {
      if (config.callback) config.callback(socket);
   });

   socket.send = function (message) {
        socket.emit('message', {
            sender: sender,
            data  : message
        });
    };

   socket.on('message', config.onmessage);
}

the server side code i use is from https://github.com/muaz-khan/WebRTC-Experiment/blob/master/socketio-over-nodejs/webrtc-signaling/signaler.js

i open two tab in my browser, but it can not signaling.

@notedit
Copy link
Author

notedit commented Jun 26, 2013

i did some debug, the https://github.com/muaz-khan/WebRTC-Experiment/blob/master/socketio-over-nodejs/webrtc-signaling/signaler.js signaler server does not work same with the firebaseIO signaler server.

for example, when a user connect a session, if the sesison already exists, the user will receive some message from the other user like this

{session: Object,
sessionid: "CAKFZMR9-KAKYB9"
userid: "DOK1XWL3-SYVI"
}

@muaz-khan
Copy link
Owner

The referenced experiment is using RTCMultiConnection-v1.3 which fails with socket.io over node.js.

You can try RTCMultiConnection-v1.2 or latest release i.e. RTCMultiConnection-v1.4.

For v.1.4; your server-side node.js code looks like this:

io.sockets.on('connection', function (socket) {
    socket.on('message', function (data) {
        socket.broadcast.emit('message', data);
    });
});

And client-side code to override openSignalingChannel:

connection.openSignalingChannel = function(callback) {
    return io.connect().on('message', callback);
};

Note: RTCMultiConnection-v1.4 is under development and maybe released next week.

@notedit
Copy link
Author

notedit commented Jun 26, 2013

thx

@notedit notedit closed this as completed Jun 26, 2013
@notedit
Copy link
Author

notedit commented Jun 26, 2013

the doc of RTCMultiConnection-v1.4 and 1.3 are the same ?

i am reading the RTCMultiConnection-v1.4 source code, if a connection just connect('session-id'), it seems that it can not do the Signaling. do i miss something?

append:

it seems that a connection will wait a broadcasting.

@muaz-khan
Copy link
Owner

Coding style is 98% same; however, in v1.4 there are many new things too. I'll try to update documentation accordingly in future commits.

A few Hints:

connection = new RTCMultiConnection( ' socketio-namespace or firebase-channel ');

// auto-connect first-available room
connection.init();

// open new room
connection.open( ' new human readable room-name ');

// manually connect a room
connection.connect( ' new human readable room-name ');

@muaz-khan
Copy link
Owner

This is latest version of RTCMultiConnection-v1.4:

https://webrtc-experiment.appspot.com/RTCMultiConnection-v1.4.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants