Appendix B. Socket.IO Backends

Socket.io started in Node.js and the primary backend continues to be Node.js. This book focuses on building a chat system with socket.io, Node.js, and Express.js. But what if your primary platform of choice is not Node.js or you are working on a project where you want the same capabilities as provided by socket.io but cannot as you have an existing standardized platform and cannot bring a new system in the equation. Many before you have faced the same dilemma and in the spirit of open source, socket.io servers exist for various platforms. In this appendix let's take a look at the various implementations available for socket.io backends.

Every platform will require you to apply the learning and logic from this book to rewrite the server-side code targeting that platform. The client code can continue to be the same.

The following is an alphabetic list of the implementations by their languages/platforms:

Erlang

There are two different backends for socket.io on erlang, Yurii Rashkovskii's socket.io-erlang (https://github.com/yrashk/socket.io-erlang) and Yongboy's erlang-socketio (https://code.google.com/p/erlang-scoketio/).

Yurii seems to have a disagreement with the path taken by socket.io's post-0.6.x releases, and so the library supports only up to Version 0.6 of the spec. Naturally, most of the examples in this book and many other examples on the Internet, won't work over it.

Yongboy's erlang-socketio seems to be keeping itself up to date with the latest happenings in socket.io and is compatible with the latest spec for socket.io-1.0 at the time of writing. Thus we will focus the rest of this section on this library.

This library is available for Cowboy and Mochiweb , two popular server-side frameworks in erlang. Both these versions support socket.io spec 1.0. The Cowboy version supports all the transports, while the Mochiweb version is limited to xhr-polling, htmlfile, and json-polling.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset