Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Websockets with Companion and External Systems

ANSWERED

 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!

Best Answer
1 BEST ANSWER

Accepted Solutions

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.

View best answer in original post

Best Answer
4 REPLIES 4

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.

Best Answer

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. 

Best Answer

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

Best Answer
0 Votes

wss:// is the secure version of ws://, it requires a valid certificate for the hostname you're using.

Best Answer
0 Votes