client updates
diff --git a/nodejs/client/client.js b/nodejs/client/client.js
index 2752539..32f7d18 100644
--- a/nodejs/client/client.js
+++ b/nodejs/client/client.js
@@ -1,7 +1,7 @@
var WebSocket = require('ws');
var host = "https://owdbg.mybluemix.net";
-var path = "/register";
+var path = "/client/register";
var uri = host + path;
console.log(uri);
@@ -10,7 +10,10 @@
ws.on('open', function open() {
console.log("CONNECTION OPEN");
- ws.send(JSON.stringify({ action: "init", key: key }));
+ ws.send(JSON.stringify({
+ type: "init",
+ key: key
+ }));
});
ws.on('message', function(data, flags) {
@@ -18,7 +21,21 @@
// flags.binary will be set if a binary data is received.
// flags.masked will be set if the data was masked.
//
- console.log(data);
+ try {
+ var message = JSON.parse(data);
+ switch (message.type) {
+ case "invoke":
+ console.log("INVOKE");
+ console.log(JSON.stringify(message, undefined, 4));
+ ws.send(JSON.stringify({
+ type: "end",
+ activationid: message.activationId
+ }));
+ break;
+ }
+ } catch (e) {
+ console.log(e);
+ }
});
/*