These are chat archives for andyet/SimpleWebRTC

7th
May 2017
Michele Sartini
@michele_sart_twitter
May 07 2017 15:31

Hi All,

I would like to use a WebSocket instead of socket.io, as suggested in Github I have implemented a Connection object that exposes the following methods: on(ev, fn), emit(), getSessionId(), disconnect() .
However I am not quite sure how to implement on(ev, fn)
Could you please help me?

Hi Guys, could you please help me with the above? Thanks

@3wkit I would like to know it as well
LuckyCyborg
@LuckyCyborg
May 07 2017 15:32
That's a titanic work, man! You have to be really, but really real motivated to do it!
The Socket.io is just a protocol and API built in top of WebSockets, after all.
The real question is: WHY you want to write yet another protocol in top of WebSockets?
Just for fun?
Jefferson de Andrade Santos
@jersobh
May 07 2017 15:57
There's also the ws library, just The same as you're doing
Michele Sartini
@michele_sart_twitter
May 07 2017 16:41
mhh the idea was to use websocket for signaling
LuckyCyborg
@LuckyCyborg
May 07 2017 16:42
You already use a WebSocket for signaling!
Michele Sartini
@michele_sart_twitter
May 07 2017 16:42
with socket.io you mean?
LuckyCyborg
@LuckyCyborg
May 07 2017 16:42
Exactly.
Michele Sartini
@michele_sart_twitter
May 07 2017 16:43
ok well in that case I don't need to use 'plain' websocket
any suggestion for implementing the signaling server using socket.io?
LuckyCyborg
@LuckyCyborg
May 07 2017 16:43
The big issue is that a bare WebSocket is not enough for signaling. You need a protocol for it. Which is exactly what Secket.io do.

Long story short WebSocket is a thing similar with the HTTP.

BUT, you cannot write a site directly into HTTP, because you need a Server which know to work with. Enter Apache.

And so, you use for your site just some HTML pages, instead to write a (complicated) HTTP server in C/C++. ;)

any suggestion for implementing the signaling server using socket.io?

They give a signaling server for socket.io, it is right on GitHub.

Michele Sartini
@michele_sart_twitter
May 07 2017 16:49
do you think is it worth it to rewrite it in Java?
LuckyCyborg
@LuckyCyborg
May 07 2017 16:49
I guess not, because Java cannot be as fast like NODEJS.
I believe that the alternative is to write a signaling server into C/C++, if you dare to replicate the Socket.io API.
Michele Sartini
@michele_sart_twitter
May 07 2017 17:00
ok thank you for you help :)