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:
Uri Shaked
2016-03-16 11:55:21 +02:00
parent 8988faf5f0
commit 00be8c7833

View File

@ -397,9 +397,12 @@ void WebSocketsClient::sendHeader(WSclient_t * client) {
"Connection: Upgrade\r\n"
"User-Agent: arduino-WebSocket-Client\r\n"
"Sec-WebSocket-Version: 13\r\n"
"Sec-WebSocket-Protocol: " + client->cProtocol +"\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) {
handshake += "Sec-WebSocket-Extensions: " + client->cExtensions + "\r\n";
}