mirror of
https://github.com/Links2004/arduinoWebSockets.git
synced 2025-07-14 07:46:30 +02:00
updated with upstream, added subprotocol to client
This commit is contained in:
@ -37,7 +37,7 @@ WebSocketsClient::~WebSocketsClient() {
|
||||
/**
|
||||
* calles to init the Websockets server
|
||||
*/
|
||||
void WebSocketsClient::begin(const char *host, uint16_t port, const char * url) {
|
||||
void WebSocketsClient::begin(const char *host, uint16_t port, const char * url, const char * Protocol) {
|
||||
_host = host;
|
||||
_port = port;
|
||||
_fingerprint = "";
|
||||
@ -55,7 +55,7 @@ void WebSocketsClient::begin(const char *host, uint16_t port, const char * url)
|
||||
_client.cIsWebsocket = true;
|
||||
_client.cKey = "";
|
||||
_client.cAccept = "";
|
||||
_client.cProtocol = "";
|
||||
_client.cProtocol = Protocol;
|
||||
_client.cExtensions = "";
|
||||
_client.cVersion = 0;
|
||||
|
||||
@ -67,8 +67,8 @@ void WebSocketsClient::begin(const char *host, uint16_t port, const char * url)
|
||||
#endif
|
||||
}
|
||||
|
||||
void WebSocketsClient::begin(String host, uint16_t port, String url) {
|
||||
begin(host.c_str(), port, url.c_str());
|
||||
void WebSocketsClient::begin(String host, uint16_t port, String url, String Protocol) {
|
||||
begin(host.c_str(), port, url.c_str(), Protocol.c_str());
|
||||
}
|
||||
|
||||
#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266)
|
||||
@ -366,7 +366,7 @@ 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: arduino\r\n"
|
||||
"Sec-WebSocket-Protocol:" + client->cProtocol +"\r\n"
|
||||
"Sec-WebSocket-Key: " + client->cKey + "\r\n";
|
||||
|
||||
if(client->cExtensions.length() > 0) {
|
||||
|
Reference in New Issue
Block a user