Websocket does not connect to server

0

I can not connect to the server.

Note: the browser supports websocket .
I'm doing the following

var socket = new WebSocket('sw: localhost:8080'); 

Any suggestions?

    
asked by anonymous 20.02.2015 / 16:54

2 answers

1

In a quick answer, you probably forgot // and you changed ws to sw , I think the correct one should be:

var socket = new WebSocket('ws://localhost:8080');
    
05.04.2015 / 00:45
0

Check the port that is configured on the server for WebSocket, port 8080 is typically used for HTTP, and WebSocket uses another port. Find the correct port and change the WebScoket builder in javascript.

    
05.03.2015 / 15:29