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.

* 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.

Tuesday, March 25, 2014

Stop grunting, become a lineman

Lately I've been trying out various dev work flow -- an integrated testing / building setup using grunt for rich client side applications (we wanted bit more than our own hand written grunt files)

We are trying lineman for a new project now. lineman uses testem instead of karma and so far our experience has been good, jasmine tests are run automaticly when files change and results shown instantly on console as well as testem chrome runner (a big pluss).

lineman also has an API proxy feature where it can act as a proxy to your real back end server for specified URL prefix.

lineman's minimalistic approach compared to yeoman's generate everything approach might help lineman to become a standard tool in our toolbox.