WebSocket

Posted on February 21, 2012

2


The introduction of HTML5 as the new standard of displaying information world web wide comes with many new possibilities.

One of the enhancements is full duplex communication between web pages and applications using a single socket, through the use of WebSockets. More information including schematic of WebSockets is available on the WebSocket.org website.

The applications of WebSockets including use in online multiplayer games such as Farmville, and real time implications such as price index. WebSockets can be used in almost any application that needs real time information and a web based interface, with the limitation being the generation of creative ways to use the technology.

Youtube video of Peter Lubbers talking about WebSockets in HTML5 event in San Francisco in 2010:

For this application, WebSocket is being considered as an option for sending a message to FrontlineSMS from a webpage and receiving a message that contains a keyword that have been defined in FrontlineSMS.

More information on WebSockets:

Websocket HTML5 tutorials

http://www.tutorialspoint.com/html5/html5_websocket.htm

Websocket API

Websocket IOS tutorial

http://www.nsbasic.com/app/tutorials/TT09.htm

Websocket tutorial

http://net.tutsplus.com/tutorials/javascript-ajax/start-using-html5-websockets-today/

Socket IO Plugin

http://socket.io/#how-to-use

FrontlineSMS Triggers

http://help.frontlinesms.com/manuals/1.6.14/httptrigger.htm

http://frontlinesms.ning.com/forum/topics/diagram-of-http-trigger?id=2052630%3ATopic%3A38704&page=2#comments

Websocket Chat application

http://www.flynsarmy.com/2010/05/php-web-socket-chat-application/

PHP and Java Connection

http://abejali.com/?p=56

NODE JS

Node Js is a platform designed for real-time data intensive applications that run across different platforms.  To install Node JS, download the correct version for the operating system being used from the Node JS website.  For mac and windows executable installers of the application are available, whilst a Linux install may require compiling the source files.

Once the package has been installed, Node can be accessed through the terminal by typing the command – node:

$ node
>

To exit the application, hit CTRL + C twice:

(^C again to quit)
$

To check the version of Node Js installed, enter the command:

$ node –version
v0.6.11
$

SOCKET IO

Socket IO is a Node JS implementation that makes real time applications possible in any browser.  The application can be installed by running the command – $ npm install socket.io – in the terminal.

After installing socket.io, you may also need to install the socket.io client, by using the command – $ npm install socket.io-client – in the terminal.

The problem that was experienced when trying to run the server.js example, by typing in the command – $node server.js was the error:

node.js:201
throw e; // process.nextTick error, or ‘error’ event on first tick
^
Error: Cannot find module ‘socket.io’
at Function._resolveFilename (module.js:332:11)
at Function._load (module.js:279:25)
at Module.require (module.js:354:17)
at require (module.js:370:17)
at Object.<anonymous> (/Applications/MAMP/htdocs/serve.js:1:72)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:31)
at Function._load (module.js:308:12)
at Array.0 (module.js:479:10)

This was resolved in mac osx by copying the socket.io folder into the node_modules folder.

KAAZING

Web socket platform for developing real time we applications
http://kaazing.com/welcome.html

NETTY
Network application development – http://netty.io/docs/unstable/guide/html/

Advertisements