Websocket getting blank position

Pramod4 years ago

Hello,
when I am connecting through websocket getting response
{"data": "{\"positions\":[]}", "isTrusted": false} . In back-end we have devices. Any reason why i am not getting data in react native through websocket.

Anton Tananaev4 years ago

We don't send devices via websocket.

Pramod4 years ago

Hello Anton,
In browser websocket we are getting data but in react native websocket we are getting empty data. Any reason?

Anton Tananaev4 years ago

You are probably doing something wrong. Why would there be a difference?

Pramod4 years ago

Earlier same code is working but suddenly it stop working. Here is sample code :-

var socket = new WebSocket(Config.Socket_URL + '/api/socket');
      socket.onmessage = function (event) {
        console.log(event);
}

Getting response :-

{"data": "{\"positions\":[]}", "isTrusted": false}