Created
February 6, 2015 20:29
-
-
Save ricomoss/9a4a55f4081697c67c81 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
//Websocket and Stomp config | |
init_stomp = function( socket_url, username, password, vhost, disable_debug ) { | |
// Stomp.js boilerplate | |
var ws = new SockJS(socket_url), | |
client = Stomp.over(ws); | |
if(disable_debug){ | |
client.debug = null; | |
} | |
// SockJS does not support heart-beat: disable heart-beats | |
client.heartbeat.outgoing = 0; | |
client.heartbeat.incoming = 0; | |
var on_connect = function() { | |
// Do super awesome stuff here | |
}; | |
var on_error = function() { | |
console.log( "error" ); | |
}; | |
client.connect( username, password, on_connect, on_error, vhost ); | |
}; | |
})(window.jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment