Socket.IO JavaScript framework ready for real-time apps

The framework leverages Node.js for bidirectional, event-based communication in mobile and web apps

The Socket.IO real-time framework for mobile and Web applications is now available as a 1.0 release. The JavaScript framework, which leverages Node.js, features an engine module for reliability and supports bidirectional, event-based communication.

Socket.IO arose out of developer Guillermo Rauch's quest to push data from the server to the client without the client requesting it. "It actually didn't matter what kind of project it was, the need was always there. This came down to a bigger, fundamental need: speed," Rauch said. Depending on the application, Socket.IO can save dramatic amounts of time in the communication path, he said.

The 1.0 release of Socket.IO bundlesis an engine module, Engine 1.0, which deals with transports and browser incompatibilities. Implementing a WebSocket-like API, Engine 1.0 allows for simplification of both the Socket.IO Server, which is only 1,234 lines of code, and Client, at 976 lines.

"This new engine we developed is a groundbreaking change in terms of reliability," said Rauch, who works at blogging services provider Automattic. "Instead of attempting a connection with WebSocket, then falling back to something else -- which can result in slow connection times -- we try first what we know will always work, connect immediately, then try to upgrade to WebSocket [after] we test it and know it works."

Socket.IO would have been difficult to envision without JavaScript on the server as well as the client, Rauch said. The message-encoding mechanism is based on JSON -- which is natural to Node.js and browsers, he said. There is much code-sharing between the browser and server to minimize the need for code maintenance and reduce the room for human error and incompatibilities, he said.

Other capabilities featured in the 1.0 version come with automated testing, in which every commit to the Socket.IO codebase triggers a testing matrix of 25 browsers, including iOS and Android systems. Scalability and an integration capability, which turns existing applications into real-time applications, are highlighted as well. Also featured are streamlined APIs and better debugging. A planned Socket.IO 2.0 release is expected to abandon support for some older browsers and not bundle modules such as the JSON serializer.

Rauch said he started developing Socket.IO shortly after Node.js came out in 2009. The 1.0 release, which became available in late May, involved more than 30 contributors. Socket.IO users have included Microsoft Office, Yammer, and Zendesk, according to Socket.IO's backers.

This story, "Socket.IO JavaScript framework ready for real-time apps" was originally published by InfoWorld.

Join the discussion
Be the first to comment on this article. Our Commenting Policies
See more