Skip to content
This repository was archived by the owner on Nov 28, 2018. It is now read-only.

Commit ca2e094

Browse files
committed
Add a quick example on using a message callback
1 parent 6a366c3 commit ca2e094

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

examples/stomp-consumer.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,14 @@ var messages = 0;
2828

2929
client.connect();
3030

31+
function message_callback(body, headers) {
32+
console.log('Message Callback Fired!');
33+
console.log('Headers: ' + sys.inspect(headers));
34+
console.log('Body: ' + body);
35+
}
36+
3137
client.on('connected', function() {
32-
client.subscribe(headers);
38+
client.subscribe(headers, message_callback);
3339
console.log('Connected');
3440
});
3541

0 commit comments

Comments
 (0)