JavaEar 专注于收集分享传播有价值的技术资料

Error in WebSocket connection to 'ws://'

I am new in here,and I wrote this code but it gives error in console :'ws://' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED.Can anybody help me ? I only try samples from internet but they don't work.

$(function () {

        ws = new XSockets.WebSocket("ws://");


    1. You have to start a XSockets server on localhost and port 4502 (default port for XSockets)
    2. You have to have a controller named broker on in the server. By the connection string it looks like you are trying to connect to a very old version of XSockets. Probably v3.*
    3. Since you are using the "broker" controller I assume that you are trying WebRTC (video/audio). If so... Take a look at this video and download this sample source code afterwards