I'm currently doing this hack to handle the websocket's onmessage.
$scope.wsCon.onMessage = function(result) {
$scope.wsCon.trigger(result.handler, result.data);
};
Problem here is that, onmessage is handling all the incoming requests through websocket.
But I need something like this:
$scope.wsCon.
.send(data)
.done(data, function (result) {
// Deal with the result here
})
.fail(data, function() {
// Show the error message
})
.complete(data, function() {
// Do this always
});
I know this is not achievable in websocket on single connection. But still, is there any way to produce effect something like the way jQuery does?