Skip to content

Instantly share code, notes, and snippets.

@ricomoss
Created February 6, 2015 20:29
Show Gist options
  • Save ricomoss/9a4a55f4081697c67c81 to your computer and use it in GitHub Desktop.
Save ricomoss/9a4a55f4081697c67c81 to your computer and use it in GitHub Desktop.
(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