简体   繁体   中英

Socket.IO connection error

I've an application in node.js with socket.io. Everything was running completely fine, but suddenly the browser started to send this error.

failed: Error in connection establishment:net::ERR_TUNNEL_CONNECTION_FAILED

I didn't make any code change.

The protocol used by socket is ws:// and when I try to use this url in browser

'ws://highgarden-nodejs-91180.sae1.nitrousbox.com/socket.io/?EIO=3&transport=websocket&sid=T9Unec8KbWw-GAL8AAAF'

Chrome returns this error:

Failed to load resource: net::ERR_DISALLOWED_URL_SCHEME

This is a part of the socket setup code:

server.js:

    var app = express();
    var server = http.createServer(app);
    var io = require('socket.io').listen(server);
    var port = process.env.PORT || 3000
*------------------------------------------*

    // routes ===
    var routes = require('./config/routes.js');
    var sock = {}
    routes(app, passport, sock); 
    io.sockets.on('connection', sock.update);

    // launch ===
    server.listen(port);

Thanks advance.

Hi the exception ERR_TUNNEL_CONNECTION_FAILED happens when a tunnel connection through the proxy could not be established. And the ERR_DISALLOWED_URL_SCHEME happens when the scheme of the URL is disallowed.

May you need use it behind the proxy!

Chrome 45.0.2454.101 m说该页面已被禁用或在服务器上移动。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM