08-23-2018 03:14
08-23-2018 03:14
09-01-2018 10:43
09-01-2018 10:43
Here's a minimal example, check it's working for you:
device/index.js
import * as messaging from "messaging"; messaging.peerSocket.onopen = function() { console.log(`Device OPEN`); sendMessage(); } messaging.peerSocket.onerror = function(err) { console.log(`Device ERROR: ${err.code} ${err.message}`); } function sendMessage() { console.log(`Device SEND`); if (messaging.peerSocket.readyState === messaging.peerSocket.OPEN) { messaging.peerSocket.send({cmd: "ping!"}); } else { console.log("Dude, where's my peerSocket?"); } }
companion/index.js
import * as messaging from "messaging"; messaging.peerSocket.onopen = function() { console.log(`Companion OPEN`); } messaging.peerSocket.onerror = function(err) { console.log(`Companion ERROR: ${err.code} ${err.message}`); } messaging.peerSocket.onmessage = function(evt) { console.log(`Companion MESSAGE: ${JSON.stringify(evt.data)}`); }
08-12-2020 08:28
08-12-2020 08:28
Actually I have the same problem.
When connecting to the simulator, your minimal example works.
However, using my Versa 2, it no longer works. The onopen isn't even called.
08-13-2020 06:25
08-13-2020 06:25
Remark to my own post: I solved the issue. 'Solved', since I removed the dev apps, restarted my iPhone and reinstalled the app again. Then it works.
Something to look at for the fitibit devs! 😉