Last active
December 17, 2015 18:08
-
-
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 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
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