8000 updated with upstream, added subprotocol to client · chrisella/arduinoWebSockets@3e0b0bd · GitHub
[go: up one dir, main page]

Skip to content

Commit 3e0b0bd

Browse files
committed
updated with upstream, added subprotocol to client
1 parent ece771a commit 3e0b0bd

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/WebSockets.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
#include <Arduino.h>
2929

30-
//#define DEBUG_WEBSOCKETS(...) Serial1.printf( __VA_ARGS__ )
30+
//#define DEBUG_WEBSOCKETS(...) Serial.printf( __VA_ARGS__ )
3131

3232
#ifndef DEBUG_WEBSOCKETS
3333
#define DEBUG_WEBSOCKETS(...)

src/WebSocketsClient.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ WebSocketsClient::~WebSocketsClient() {
3737
/**
3838
* calles to init the Websockets server
3939
*/
40-
void WebSocketsClient::begin(const char *host, uint16_t port, const char * url) {
40+
void WebSocketsClient::begin(const char *host, uint16_t port, const char * url, const char * Protocol) {
4141
_host = host;
4242
_port = port;
4343
_fingerprint = "";
@@ -55,7 +55,7 @@ void WebSocketsClient::begin(const char *host, uint16_t port, const char * url)
5555
_client.cIsWebsocket = true;
5656
_client.cKey = "";
5757
_client.cAccept = "";
58-
_client.cProtocol = "";
58+
_client.cProtocol = Protocol;
5959
_client.cExtensions = "";
6060
_client.cVersion = 0;
6161

@@ -67,8 +67,8 @@ void WebSocketsClient::begin(const char *host, uint16_t port, const char * url)
6767
#endif
6868
}
6969

70-
void WebSocketsClient::begin(String host, uint16_t port, String url) {
71-
begin(host.c_str(), port, url.c_str());
70+
void WebSocketsClient::begin(String host, uint16_t port, String url, String Protocol) {
71+
begin(host.c_str(), port, url.c_str(), Protocol.c_str());
7272
}
7373

7474
#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266)
@@ -366,7 +366,7 @@ void WebSocketsClient::sendHeader(WSclient_t * client) {
366366
"Connection: Upgrade\r\n"
367367
"User-Agent: arduino-WebSocket-Client\r\n"
368368
"Sec-WebSocket-Version: 13\r\n"
369-
"Sec-WebSocket-Protocol: arduino\r\n"
369+
"Sec-WebSocket-Protocol:" + client->cProtocol +"\r\n"
370370
"Sec-WebSocket-Key: " + client->cKey + "\r\n";
371371

372372
if(client->cExtensions.length() > 0) {

src/WebSocketsClient.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ class WebSocketsClient: private WebSockets {
3636
WebSocketsClient(void);
3737
~WebSocketsClient(void);
3838

39-
void begin(const char *host, uint16_t port, const char * url = "/");
40-
void begin(String host, uint16_t port, String url = "/");
39+
void begin(const char *host, uint16_t port, const char * url = "/", const char * Protocol = "arduino");
40+
void begin(String host, uint16_t port, String url = "/", String Protocol = "arduino");
4141

4242
#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266)
4343
void beginSSL(const char *host, uint16_t port, const char * url = "/", const char * = "");

0 commit comments

Comments
 (0)
0