-
Notifications
You must be signed in to change notification settings - Fork 866
Open
Labels
Description
so, I'm trying to proxy a websocket within gulp, using http-proxy-middleware.
my backend server code is this
var app = require('express')();
var server = require('http').createServer(app);
var io = require('socket.io')(server,{ path: '/socket.io'});
io.on('connection', function(){ console.log("woot! connection")/* … */ });
server.listen(5000);
and my gulp code is this
var server = {
baseDir: baseDir,
routes: routes
};
var proxies = [];
proxies.push(proxyMiddleware('/socket.io', { target: 'http://localhost:5000/' , ws: true}));
server.middleware = proxies;
browserSync.instance = browserSync.init({
startPath: '/',
server: server,
browser: browser
});
on the console I see
woot! connection
[HPM] Upgrading to WebSocket
[HPM] Client disconnected
and the client console has
WebSocket connection to 'ws://mysite.io/socket.io/?EIO=3&transport=websocket&sid=5_BeDfck0LFYcYxPAAAA' failed: Error during WebSocket handshake: Unexpected response code: 502
Am I missing something ?
thanks
gustavodegeus