Skip to content

Instantly share code, notes, and snippets.

@mguymon
Last active December 17, 2015 18:08
Show Gist options
  • Save mguymon/5650595 to your computer and use it in GitHub Desktop.
Save mguymon/5650595 to your computer and use it in GitHub Desktop.
Example JS that will subscribe to a WebSocket and register a callback for messages
this.YourApp = {
stompSubscribe: function(queue, callback) {
var client;
client = Stomp.client("ws://localhost:8675/");
client.connect("", "", function(frame) {
client.subscribe(queue, function(msg) {
return callback(msg);
});
});
return client;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment