-
Notifications
You must be signed in to change notification settings - Fork 28
Description
Hi!
For a project that I'm working on, I would like to connect through websockets first, and fall back on polling later on. Although not officially supported by the engine.io protocol, the Socket.IO manual specifically mentions this possibility, see 'With websocket transport only'.
When trying this with the engine.io and socket.io haskell library, this does not work. However, trying the following node.js setup with the socket.io implementation, it connects perfectly.
app.js
const io = require('socket.io-client');
var socket = io("http://localhost:4004", {path:"/mysocket", transports:['websocket']});
socket.on('connect', ()=>{
console.log('connected');
});
Server.js
var io = require('socket.io')(4000,{path:"/mysocket"});
io.on('connection', (socket)=> {
console.log('connection');
});
Looking at the logs wireshark creates, the issue seems to be the reply that the server sends: while the js implementation sends a response 101 (Switching Protocols), the haskell implementation responds with a 200 (OK), which is the default response at the end of the 'freshSession' function.