The last week I told you about
the crazy weekend I had with the
ReatTimeWeb conference and the
3DS seminary, but also I promised you to talk about some ideas they give me related to the signalling problem. Ok, here we go: they worked :-D
The problem is simple, althought not easy to solve (someone told me I touched the
Holy Grail of Internet... :-P ): a web browser on a LAN can go and surf over Internet without problems, since it's a request from the internal network to a server the bigger Internet, there's no mistery here. Since this way every browser can access to Internet, they could be able to be reached on the other way from one browser to another, but how to do this without using a server, or at least without deploying a custom one, just using currently available Internet technologies?
On a first point, I though about
SIP, and specially
SIP-over-WebSockets, a specification to use WebSockets as transport layer for SIP communications instead of plain BSD sockets (and whose author I was able to meet and talk on person on the conference :-) ). I worked hard here until I got noticed by a bad point: public SIP servers require to have a registered account somewhere to allow to connect to them, what breaks annonimity in a very bad way (and having the user to create a new random account on every page reload it's all except user friendly...). Thinking about it, I took a look at
XMPP (Jabber), since being a from-the-people builded protocol it would probably to have an annonimous session option... and yes,
it has it, but only on the EJabberD server implementation and any of the public servers has it enabled. End road.
Being so frustated by not being able to send a little piece of text from one end to another one without a server or a previously created PeerConnection (who give us up to the chicken-or-the-egg problem...) and not being able to use directly the STUN servers (PeerConnection manage the connection creation just doing what I wanted to do, but the specification doesn't give access to this low-level functionality) I decided to wait until the conference, where they gave me a little proposition about how to solve it, although I was a little reluctant about it, and in fact I believe they didn't hope it would work flawlessly: PubNub.
PubNub is a web service that allow to publish messages to a group of peers subscribed to a channel. It's say: you send a message, and it's received by everyone it's listening. It's a little bit like killing a fly with a gun since the signalling message is sent to everyone is connected, but checking by hand that the message is for you the problem is easy to solve and also it has several advantages:
- It's not a dedicated server, it's a public server, so it's dificult to break it down (there would be too much affected...)
- there are other alternatives, and also it's being developed a public specification
- the free accounts have a very restrictive limit about the number of connected peers, what helps to focus on it as a bootstrap protocol and change inmediatelly on a DataChannels based one, increaing the network density just as I designed originally (the last week I was too much focused thinking about using the signalling channel for everything...)
But also it has another good point: since I have been testing so much protocols these day and thinking about to be able to use several of them at a time since no one gave me the flexibility and annonimity I wanted, the fact is that I ended developing a
SignalingManager that could be able to abstract the signalling mechanism and adding a new one was just a matter of build a little class, so I did a new one for PubNub (after registering me as a developer on their page), launched the webapp... and it worked, period. Just like magic the both peers were talking though PubNub without a dedicated server... and also from two different host domains!!! :-D This means that you can download the webapp from different hosting and all of them could be able to communicate, allowing more heterogenety: if one of them gets down, you just need to navigate to another one and keep sharing :-) I need to investigate about how to share IndexedDB between the different domains in case of problems, but it seems will be something difficult to achieve and will only be able to show "backup cache" link so you can import it on another one... :-/
But these are only the good news? No, there's another one, maybe more little, but with greater consecuences: yesterday I was helping to Arindra Das over Skype with her problems with ShareIt! (really, he found a bug :-P ) and asked to him to share something so I could be able to make some test on my side, and the fact was that "magically" a PDF was shared with me from Findland to Spain. Yes: ShareIt! WORKS!!! :-D Having problems previously on some demos and not able to test it before between machines (just my main computer and my parent's one, both on my home LAN), it was a great surprise to see that it worked on the wild Internet, so adding this the "server-less" signalling thanks to PubNub, when we got native DataChannels on the browsers this project will be able to take flight :-D Let's hope they will be ready for New Year Eve... ;-)