octoblu / meshblu

Meshblu is a cross-protocol IoT machine-to-machine messaging system.
https://meshblu.readme.io/
MIT License
816 stars 182 forks source link

Issues about "subscribe" API in WebSocket with Meshblu 4.0.1 #142

Closed cydemily closed 7 years ago

cydemily commented 7 years ago

Hello, I met below issues on “subscribe” function in WebSocket protocol by using Meshblu 4.0.1 instead of Meshblu 1.18.4.

Test scenario:

  1. Register devide#1 and device#2 with WebSocket protocol, and add device#1 into device#2’s whitelist.
  2. Device#2 subscribes device#1, and set it online.
  3. Set device#1 online, note that device#2 did not receive any message from device#1.
  4. Set device#2 offline, note that device#2 did not receive any message from device#1.

But I really need device#1 online and offline broadcast message as below to notify other devices about the status of device#1.

Is this a bug or new feature?

Device online broadcast message: 3

Device offline broadcast message: 4

cydemily commented 7 years ago

Solved.

solution:

  1. Add device online message: ① Found the file: meshblu-core-protocol-adapter-websocket/src/websocket-handler.coffee ② Added the setOnlineStatus function. ③ In onIdentity function, call setOnlineStatus function.

  2. Add device offline message: ① Found the file: meshblu-core-protocol-adapter-websocket/src/websocket-handler.coffee ② In onClose function, call setOnlineStatus function.