jQuery Simple WebSocket - a fluent, gracefull websocket
npm install jquery-simple-websocket


Send and receive data through a fluent deferred interface, handling connections gracefully.
```
fluent:
``
var webSocket = $.simpleWebSocket({ url: 'ws://127.0.0.1:3000/' })
.listen(function(message) { console.log('listener1: '+message.text); })
.listen(function(message) { console.log('listener2: '+message.text); })
.listen(function(message) { console.log('listener3: '+message.text); })
.send({'text': 'hello'});
var socket = $.simpleWebSocket(
{
url: 'ws://127.0.0.1:3000/',
protocols: 'your_protocol', // optional
timeout: 20000, // optional, default timeout between connection attempts
attempts: 60, // optional, default attempts until closing connection
dataType: 'json' // optional (xml, json, text), default json
}
);socket.connect();
socket.isConnected(); // or: socket.isConnected(function(connected) {});
socket.send({'foo': 'bar'});
socket.listen(function(data) {});
socket.remove(listenerCallback);
socket.removeAll();
socket.close();
`$3
- start nodejs websocket server:
`
$ node src/server.js
``