From 5a0e60857ae3446ac0eed7654081f2e9ab2e19e1 Mon Sep 17 00:00:00 2001 From: Aaron Gong Date: Fri, 2 Dec 2016 18:26:41 +0800 Subject: [PATCH] Fix Error in NodeJS consumer code There was some problems with the URL and also the data packet coming in was a string and should be parsed... --- docs/WebSocket.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/WebSocket.md b/docs/WebSocket.md index c465b139bb6ce..7b15590075d55 100644 --- a/docs/WebSocket.md +++ b/docs/WebSocket.md @@ -271,10 +271,10 @@ ws.on('message', function(message) { ```javascript var WebSocket = require('ws'); var socket = new WebSocket( - "ws://localhost:6080/pubilsh/persistent/my-property/us-west/my-ns/my-topic1/my-sub-1") + "ws://localhost:8080/ws/consumer/persistent/my-property/us-west/my-ns/my-topic1/my-sub1") socket.onmessage = function(pckt){ - var receiveMsg = pckt.data; + var receiveMsg = JSON.parse(pckt.data); var ackMsg = {"messageId" : receiveMsg.messageId} socket.send(JSON.stringify(ackMsg)); };