WebSocket connection fails with Error 400
RogerG007 opened this issue · 6 comments
The newest openhabian release causes Frontail 4.9.1 to not being able to display any logs. On web console the fault message can be seen:
index.js:83 WebSocket connection to 'ws://192.168.0.51:9001/socket.io/?EIO=3&transport=websocket' failed: Error during WebSocket handshake: Unexpected response code: 400
As a workaround, editing web/index.html and changing transports: ['websocket']
to transports: ['polling']
makes it workable again or alternatively, downgrading to 4.9.0.
Any idea what the real cause could be for this error message?
Hi @mthenw,
with Socket.IO 2.4 the default CORS behavior changed, which breaks functionality for RogerG007's and openhabians's (a tailored raspberry distro for running openhab) use-case.
IMHO pinning the Socket.IO version to 2.3 or adding the CORS change should resolve this issue.
socketio/socket.io#3740
https://socket.io/blog/socket-io-2-4-0/
@bwiessneth do you mind creating a PR?
I was about to start on this when I saw that this (breaking) change was reverted with socket.io 2.4.1 (https://github.com/socketio/socket.io/releases/tag/2.4.1).
As long as the socket.io version string in pacakage.json stays like it is now, there should be no future issue with CORS / socket.io
My setup broke today and I guess my issue is related to this one. I was bravely using the latest
tag of the docker image (which was rebuild yesterday). Afaik the only change was this: 38022f7.
I am now using the 4.9.1 tag instead of latest and my setup is working again.
@mthenw: If no changes are required, would you simply update the docker image on docker hub with the latest node_modules?
The latest tag is unfortunately still referring to a non-working image...
Thanks!
Should be fixed in 4.9.2.