{"action":"closed","issue":{"url":"https://api.github.com/repos/octoblu/meshblu/issues/95","labels_url":"https://api.github.com/repos/octoblu/meshblu/issues/95/labels{/name}","comments_url":"https://api.github.com/repos/octoblu/meshblu/issues/95/comments","events_url":"https://api.github.com/repos/octoblu/meshblu/issues/95/events","html_url":"https://github.com/octoblu/meshblu/issues/95","id":89982485,"number":95,"title":"TypeErrors using MQTT or websocket","user":{"login":"MartinRoesch","id":2005078,"avatar_url":"https://avatars.githubusercontent.com/u/2005078?v=3","gravatar_id":"","url":"https://api.github.com/users/MartinRoesch","html_url":"https://github.com/MartinRoesch","followers_url":"https://api.github.com/users/MartinRoesch/followers","following_url":"https://api.github.com/users/MartinRoesch/following{/other_user}","gists_url":"https://api.github.com/users/MartinRoesch/gists{/gist_id}","starred_url":"https://api.github.com/users/MartinRoesch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MartinRoesch/subscriptions","organizations_url":"https://api.github.com/users/MartinRoesch/orgs","repos_url":"https://api.github.com/users/MartinRoesch/repos","events_url":"https://api.github.com/users/MartinRoesch/events{/privacy}","received_events_url":"https://api.github.com/users/MartinRoesch/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-06-22T00:58:03Z","updated_at":"2015-09-03T14:48:57Z","closed_at":"2015-09-03T14:48:57Z","body":"I'm running meshblu in a docker container and wrote test client using the meshblu-mqtt node module. The client periodically broadcasts a message that results in a TypeError in the container:\r\n```\r\n{\"name\":\"mosca\",\"hostname\":\"7828215cab06\",\"pid\":12,\"client\":\"d62201dd-9eef-4716-83a7-8f6c264640bb\",\"level\":20,\"timeout\":1500000,\"msg\":\"setting keepalive timeout\",\"time\":\"2015-06-22T00:19:49.909Z\",\"v\":0}\r\n{\"name\":\"mosca\",\"hostname\":\"7828215cab06\",\"pid\":12,\"client\":\"d62201dd-9eef-4716-83a7-8f6c264640bb\",\"level\":20,\"packet\":{\"topic\":\"message\"},\"msg\":\"published packet\",\"time\":\"2015-06-22T00:19:49.910Z\",\"v\":0}\r\n[TypeError: Cannot call method 'in' of undefined]\r\n```\r\nAnd when I try to send a message to the test client using the REST interface, another TypeError is thrown:\r\n```\r\nObject #<MessageIO> has no method 'in' TypeError: Object #<MessageIO> has no method 'in'\r\n  at /usr/src/app/lib/messageIOEmitter.coffee:16:7\r\n  at arrayEach (/usr/src/app/node_modules/lodash/index.js:1314:13)\r\n  at Function.<anonymous> (/usr/src/app/node_modules/lodash/index.js:3355:13)\r\n  at MessageIOEmitter.emit (/usr/src/app/lib/messageIOEmitter.coffee:14:7)\r\n  at /usr/src/app/lib/messageIOEmitter.coffee:1:1\r\n  at /usr/src/app/lib/sendMessage.js:132:11\r\n  at /usr/src/app/lib/simpleAuth.coffee:11:17\r\n  at [object Object]._onTimeout (/usr/src/app/node_modules/lodash/index.js:1777:43)\r\n  at Timer.listOnTimeout [as ontimeout] (timers.js:112:15)\r\n```\r\n\r\nI wrote the same test client using the meshblu node module (websocket), which results in the following TypeError when the client broadcasts a message:\r\n```\r\nObject #<MessageIO> has no method 'in' TypeError: Object #<MessageIO> has no method 'in'\r\n  at /usr/src/app/lib/messageIOEmitter.coffee:16:7\r\n  at arrayEach (/usr/src/app/node_modules/lodash/index.js:1314:13)\r\n  at Function.<anonymous> (/usr/src/app/node_modules/lodash/index.js:3355:13)\r\n  at MessageIOEmitter.emit (/usr/src/app/lib/messageIOEmitter.coffee:14:7)\r\n  at /usr/src/app/lib/messageIOEmitter.coffee:1:1\r\n  at broadcastMessage (/usr/src/app/lib/sendMessage.js:59:5)\r\n  at Object.sendMessage (/usr/src/app/lib/sendMessage.js:161:5)\r\n  at /usr/src/app/lib/socketLogic.js:147:16\r\n  at /usr/src/app/lib/socketLogic.js:33:14\r\n  at /usr/src/app/lib/whoAmI.js:10:5\r\n  at deviceFound (/usr/src/app/lib/getDevice.coffee:6:5)\r\n  at deviceFound (/usr/src/app/lib/getDeviceWithToken.coffee:48:5)\r\n  at /usr/src/app/lib/getDeviceWithToken.coffee:35:5\r\n  at callback (/usr/src/app/node_modules/nedb/lib/executor.js:30:17)\r\n  at Cursor.execFn (/usr/src/app/node_modules/nedb/lib/datastore.js:449:14)\r\n  at Cursor._exec (/usr/src/app/node_modules/nedb/lib/cursor.js:172:17)\r\n  at /usr/src/app/node_modules/nedb/lib/executor.js:40:13\r\n  at Object.q.process (/usr/src/app/node_modules/nedb/node_modules/async/lib/async.js:731:21)\r\n  at next (/usr/src/app/node_modules/nedb/node_modules/async/lib/async.js:728:27)\r\n  at Object._onImmediate (/usr/src/app/node_modules/nedb/node_modules/async/lib/async.js:24:16)\r\n  at processImmediate [as _immediateCallback] (timers.js:354:15)\r\n```\r\n\r\nHere's the code of the client using the meshblu-mqtt module:\r\n```javascript\r\nvar meshblu = require('meshblu-mqtt');\r\nvar conn = meshblu.createConnection({\r\n  \"uuid\": \"d62201dd-9eef-4716-83a7-8f6c264640bb\",\r\n  \"token\": \"48f8a93f41e61bd89a8449d07a55a4e736cfee48\",\r\n  \"qos\": 0, // MQTT Quality of Service (0=no confirmation, 1=confirmation, 2=N/A)\r\n  \"host\": \"localhost\", // optional - defaults to meshblu.im\r\n  \"port\": 1883  // optional - defaults to 1883\r\n});\r\nconn.on('ready', function(){\r\n  console.log('UUID AUTHENTICATED!');\r\n  //Listen for messages\r\n  conn.on('message', function(message){\r\n    console.log('message received', message);\r\n  });\r\n  setInterval(function(){\r\n        var data = Math.random()*100\r\n        console.log(\"sending temperature: \"+data);\r\n\tconn.message({\r\n            \"devices\": \"*\",\r\n            \"payload\": {\r\n                \"temp\": data\r\n            }\r\n        });\r\n\r\n    },3000);\r\n});\r\n```\r\nAnd here's the code of the client using the meshblu module:\r\n```javascript\r\nvar meshblu = require('meshblu');\r\nvar uuid = \"d62201dd-9eef-4716-83a7-8f6c264640bb\"\r\nvar token = \"48f8a93f41e61bd89a8449d07a55a4e736cfee48\"\r\nvar conn = meshblu.createConnection({\r\n    \"server\": \"localhost\",\r\n    \"port\": 8080,\r\n    \"uuid\": uuid,\r\n    \"token\": token\r\n});\r\nconn.on('notReady', function(data){\r\n    console.log('UUID FAILED AUTHENTICATION!');\r\n    console.log(data);\r\n});\r\nconn.on('ready', function(data){\r\n    console.log('UUID AUTHENTICATED!');\r\n    setInterval(function(){\r\n        var data = Math.random()*100\r\n        console.log(\"sending temperature: \"+data);\r\n\tconn.message({\r\n            \"devices\": \"*\",\r\n            \"payload\": {\r\n                \"temp\": data\r\n            },\r\n            \"qos\": 0\r\n        });\r\n    },3000);\r\n    conn.on('message', function(data){\r\n        console.log('message received:');\r\n        console.log(data);\r\n    });\r\n});\r\n```\r\nAny ideas what's going wrong here?"}}