User Supplied Socket.io demo & Socket.io 1.X support

96 views
Skip to first unread message

Angel Todorov

unread,
Mar 24, 2015, 6:39:56 AM3/24/15
to eas...@googlegroups.com
Hi there,
This is somehow related to my previous question - https://groups.google.com/forum/#!topic/easyrtc/c9-xnriExI8.
I downloaded server_examples folder, unzip it and in package.json set socket.io to "*". After installation of the package I have got both easyrtc and socket.io most recent version. In the case of socket.io it is 1.3.5.
Next I just start one of your demo bundled with easyrtc - http://demo.easyrtc.com/demos/demo_instant_messaging_selfconnect.html and I have got following error:

easyrtc.js:4531 Uncaught TypeError: Cannot read property 'connected' of undefined
easyrtc.js:4531 connectToWSServer
easyrtc.js:5450 connect
demo_instant_messaging_selfconnect.js:55 connect
demo_instant_messaging_selfconnect.html:62 onclick

I checked the same example on your demo.easyrtc.com site and it looks like it works still with socket.io 0.9.x version.

It seems that this particular example is not socket.io 1.x compatible and what is send to easyrtc.useThisSocketConnection(mysocket); is not what this method expects.

Could you please support me with more up-to-date feedback how to use easyrtc with external socket, when it is socket.io 1.x compatible?

Thanks,
Angel

Angel Todorov

unread,
Mar 24, 2015, 7:36:41 AM3/24/15
to eas...@googlegroups.com
Well, after some additional digging I did this fix on easyrtc.js file:
line 4531:
        if (preallocatedSocketIo /*&& preallocatedSocketIo.socket.connected*/) {
            connectHandler(null);
        }

This allows me to use external socket.io which is 1.x compatible.

Nevertheless, I would be nice if somebody form EasyRTC team either confirms this or proposes better solution for the case.

Best Regards,
Angel

Eric Davies

unread,
Mar 30, 2015, 12:21:16 AM3/30/15
to eas...@googlegroups.com
Hi Angel,

I've just pushed a fix to the beta branch (issue #129).
Please let me know if that solves the problem for you.

Eric.

Angel Todorov

unread,
Mar 31, 2015, 2:26:08 PM3/31/15
to eas...@googlegroups.com
Hi Eric,
Thanks! I will take a look and let you know.

Angel

Angel Todorov

unread,
Mar 31, 2015, 3:50:25 PM3/31/15
to eas...@googlegroups.com
Just one quesiton - on the client side, the usage remains the same, I assume?

    var mysocket = io.connect(null, {
                'connect timeout': 10000,
                'force new connection': true
            });
           
         
    if (!mysocket) {
        throw "io.connect failed";
    }
    else {
        console.log("application allocated socket ", mysocket);
        easyrtc.useThisSocketConnection(mysocket);
    }


Regards,
Angel

Angel Todorov

unread,
Mar 31, 2015, 4:08:18 PM3/31/15
to eas...@googlegroups.com
OK, it seems it works, Eric.

Thanks again for your prompt support!

Regards,
Angel
Reply all
Reply to author
Forward
0 new messages