Saturday, March 29, 2014

ng-socket -- an angularjs wrapper around SockJS

Take a look at ng-socket an Angular JS module which can be used to integrate SockJS in to your angular JS projects.

Features:
* Incoming messages are broadcasted on $rootScope.
* Can specify custom message parser and formatter for integrating in to your custom protocol.
* Rate limits broadcasting of incoming messages to twice per second and wraps the broadcast in $rootScope.$apply.
* Can re-connect on disconnects with configurable interval.
* Queues sent messages if socket is not yet connected and sends them on connection.
* Broadcasts open event on connection enabling users to send special messages before other messages (authentication etc).
* broadcastPrefix configuration option allows all broadcasted messages including received from server to be prefixed. Default is "$socket.".

Project is a lineman app. You can either clone the repo and get the app/ng-socket.js or run lineman build and get the minified version from dist/js/ng-socket.js.

More documentation to be followed.

No comments:

Post a Comment