Closed zekageri closed 5 months ago
Can it happan that
Sec-WebSocket-Accept
header is not specified on handshake?
No, the header is always set here https://github.com/websockets/ws/blob/8.16.0/lib/websocket-server.js#L382.
Strange, my client can't see it...
$ cat index.js
const WebSocket = require('ws');
const ws = new WebSocket('ws://bridgetest-9q8c.onrender.com/', {
followRedirects: true
});
ws.on('redirect', function (url) {
console.log(url);
});
ws.on('upgrade', function (response) {
console.log(response.headers);
});
ws.on('open', ws.close);
$ node index.js
wss://bridgetest-9q8c.onrender.com/
{
date: 'Wed, 17 Jan 2024 17:58:49 GMT',
connection: 'upgrade',
upgrade: 'websocket',
'sec-websocket-accept': 'i4X3O6pkgSy2QVrjTp3vZhJ+T0k=',
'cf-ray': '84707d10fd820e1b-MXP',
'cf-cache-status': 'DYNAMIC',
'set-cookie': [
'_cfuvid=L683UfuKzUAIfKAmtUfAKER28jtalDaaDA6LbSALDXo-1705514329842-0-604800000; path=/; domain=.onrender.com; HttpOnly; Secure; SameSite=None'
],
server: 'cloudflare',
'alt-svc': 'h3=":443"; ma=86400'
}
It seems that
ws:
redirects to wss:
. Your client might not follow redirects.Oh its redirecting. Thank you for your help. I will investigate that.
I'm closing this as answered.
The problem still presist, most likely the lowercase headers causing it
Yes, but it's not a ws issue.
Is there an existing issue for this?
Description
I want to write a websocket client application for ESP32. For this I'm using the native ESP32 IDF websocket client library.
When the clients wants to connect to my node,js server which hosts websocket with express app i got
Sec-WebSocket-Accept not found
.Here is my node.js implementation
It should be very simple. My server is reachable at
ws://bridgetest-9q8c.onrender.com/
It can be http or https.Can it happan that
Sec-WebSocket-Accept
header is not specified on handshake?ws version
latest
Node.js Version
latest
System
render.com
Expected result
My client should connect to my node.js server.
Actual result
My client throws an error that it can not find the
Sec-WebSocket-Accept
header on handshake.Attachments
Websocket client is based on the standard: https://www.rfc-editor.org/rfc/rfc6455.txt
Some debug messages from ESP32