Here is some code that has been written for web-socket using stomp protocol.
function WS(url) {
    var ws = new SockJS('/notifications');
    this.client = Stomp.over(ws),
    this.client.connect('', '', function() {
        console.log('Connected');
    }, function(error) {
        console.log('STOMP protocol error: ', error.headers.message);
    });
}
WS.prototype.disconnect = function() {
};
WS.prototype.subscribe = function() {
};
WS.prototype.unSubscribe = function() {
};
WS.prototype.send = function(msg) {
};
I found this post but it requires actual connection to server, Unit testing Node.js and WebSockets (Socket.io)
How do we test this using Jasmine. Looking for a way to fake web-socket server and fire events (connect, disconnect etc). I'll appreciate any example or useful link.
 
     
     
    