Web Socket connection

starl1n2 years ago

Hi everyone,

Hope everything is going well, I have a question regarding websocket connection on a custom frontend I'm doing .

  1. If I upload the solution to a server that I have with Ubuntu the server connect the server connects but if I'm trying from my localhost got error, don't see any details of why it fails
  2. Also I just notice that I must first have to open Traccar frontend in order for the api of websocket to respond properly.

So the question here is what kind of validations you suggest me to do in order to make it work properly? Is related to SSL running locally, or should I always ping the frontend somehow to keep it "alive".

Appreciate any feedback regarding this topic.

Best regards

Anton Tananaev2 years ago
  1. What's the error?
  2. What happens if you don't?
starl1n2 years ago

Thank you for the response:

1- This is what I get when I capture the error event listener

socket.addEventListener('error', (event) => {
  console.log('WebSocket error: ', event);
});
WebSocket error:  
Event {isTrusted: true, type: 'error', target: WebSocket, currentTarget: WebSocket, eventPhase: 2, …}
isTrusted
...

2- I get like a 404 error, looks like is a warmup thing, but don't know yet how to confirm is that exactly.

Anton Tananaev2 years ago

I would recommend checking browser network tools for both issues. For the WebSocket we need to see what the actual error is. For the 404, we need to know at least the endpoint and ideally payload.