var ws = new WebSocket("wss://artgrek.ru:8143", ); ws.send(JSON.stringify(LoginMessage)); 

Uncaught DOMException: Failed to execute 'send' on 'WebSocket': Still in CONNECTING state

UPD

The question is removed, port 8143 is not opened on the server.

UPD The question is open, I made a mistake, the error is in place.

In addition, even if ws.send is removed, an error occurs in 5-10 seconds

WebSocket connection to 'wss: //artgrek.ru: 8143 /' failed: Error in connection establishment: net :: ERR_CONNECTION_TIMED_OUT

  • 2
    Wait for the connection and then send, your cap. The onopen event is mentioned in any documentation - andreymal
  • @andreymal if you leave only var ws = new WebSocket ("wss: //artgrek.ru: 8143",); then a timeout error occurs as in the addition of the question - ArtGrek13
  • Try to connect first locally, if you do, the problem is in the ports - ArchDemon

0