How to add websocket to a wix website?

Hi guys, I would like a websocket back-end code to my website, this one:

var ws = new WebSocket(‘wss://ws.binaryws.com/websockets/v3?app_id=goodtry’);

ws.onopen = function(evt) {
ws.send(JSON.stringify({ticks:‘R_100’}));
};

ws.onmessage = function(msg) {
var data = JSON.parse(msg.data);
console.log(‘ticks update: %o’, data);
};

How can I do this?

1 Like

As per our forum guidelines and search before posting and you would find out already…

https://www.wix.com/corvid/forum/community-discussion/is-wix-capable-of-creating-a-web-socket
https://www.wix.com/corvid/forum/community-discussion/websocket-error

hey GOS: just followed forum guidelines and found your post. Neither of the links you posted answered the OP’s question. So the question still stands. How can you integrate websocket into wix website?

Would like to know this aswell. Is there anyway to use wix also as a websocket server? I have a part of my website that I would like to integrate with a different website and would like to exchange data in realtime with that website

The answer is that web socket is not supported and can’t be used on Wix.
You can either use a third party (and which will connect to the other website and you’ll ping it when needed) or user other technologies. If this other website has an API you can just post to it when it’s relevant.

Check the realtime Wix API.

This can be helpful →
https://www.wix.com/corvid/forum/tips-tutorials-examples/real-time-api