mirror of
https://github.com/Links2004/arduinoWebSockets.git
synced 2025-07-15 00:06:30 +02:00
Make the Sec-WebSocket-Protocol
header optional
Some server implementations (e.g. slack bots api) don't accept the connection if `Sec-WebSocket-Protocol` is specified.
This commit is contained in:
@ -397,9 +397,12 @@ void WebSocketsClient::sendHeader(WSclient_t * client) {
|
|||||||
"Connection: Upgrade\r\n"
|
"Connection: Upgrade\r\n"
|
||||||
"User-Agent: arduino-WebSocket-Client\r\n"
|
"User-Agent: arduino-WebSocket-Client\r\n"
|
||||||
"Sec-WebSocket-Version: 13\r\n"
|
"Sec-WebSocket-Version: 13\r\n"
|
||||||
"Sec-WebSocket-Protocol: " + client->cProtocol +"\r\n"
|
|
||||||
"Sec-WebSocket-Key: " + client->cKey + "\r\n";
|
"Sec-WebSocket-Key: " + client->cKey + "\r\n";
|
||||||
|
|
||||||
|
if(client->cProtocol.length() > 0) {
|
||||||
|
handshake += "Sec-WebSocket-Protocol: " + client->cProtocol + "\r\n";
|
||||||
|
}
|
||||||
|
|
||||||
if(client->cExtensions.length() > 0) {
|
if(client->cExtensions.length() > 0) {
|
||||||
handshake += "Sec-WebSocket-Extensions: " + client->cExtensions + "\r\n";
|
handshake += "Sec-WebSocket-Extensions: " + client->cExtensions + "\r\n";
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user