12-27-2018 12:48
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

12-27-2018 12:48
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
The docs are missing examples on using the websockets api on the companion. Is it possible to have a websocket between the companion and an external server?
I want to do something similar to the Leaderboard app where you can cheer/taunt a friend. I was thinking of doing this with websockets, but if there is another way, please let me know 🙂
Thanks!
Answered! Go to the Best Answer.
Accepted Solutions
12-28-2018 11:11
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post



12-28-2018 11:11
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
You can use WebSockets as long as you've requested the access_internet permission and you're connecting to a secure server (ie wss://).
You can see docs here: https://developer.mozilla.org/en-US/docs/Web/API/WebSocket
For your describe use case, it sounds like fetch would be sufficient though. WebSockets are useful if you want the server to be able to push data to the companion, but if you're just pushing actions regular HTTP requests should be sufficient.
12-28-2018 11:11
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post



12-28-2018 11:11
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
You can use WebSockets as long as you've requested the access_internet permission and you're connecting to a secure server (ie wss://).
You can see docs here: https://developer.mozilla.org/en-US/docs/Web/API/WebSocket
For your describe use case, it sounds like fetch would be sufficient though. WebSockets are useful if you want the server to be able to push data to the companion, but if you're just pushing actions regular HTTP requests should be sufficient.
04-08-2019 08:40
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

04-08-2019 08:40
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
The original poster asked about websockets, not about Fetch.
Redirecting the question leaves users who are looking for websocket information and examples driving down a dead end road.
09-22-2019 19:52
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

09-22-2019 19:52
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I made ws server and client to connect my fitbit versa and externel system (3rd party system)
But It appears that I have to use wss protocol
What is defference with ws and wss protocol?
Do you have any wss server example???
I really hard to make wss server
Please give me answer as soon as possible
My email address is abraham728@hanmail.net
If you need my code I can show you my code.
But my code is just websocket server's basic example

09-23-2019 02:02
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post



09-23-2019 02:02
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
wss:// is the secure version of ws://, it requires a valid certificate for the hostname you're using.

