8000 Merge remote-tracking branch 'remotes/origin/master' into async · robokoding/arduinoWebSockets@0a8a897 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0a8a897

Browse files
committed
Merge remote-tracking branch 'remotes/origin/master' into async
Conflicts: src/WebSockets.h
2 parents 76853c7 + 005441d commit 0a8a897

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/WebSocketsClient.cpp

Lines changed: 9 additions & 9 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
#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266)
@@ -57,7 +57,7 @@ void WebSocketsClient::begin(const char *host, uint16_t port, const char * url)
5757
_client.cIsWebsocket = true;
5858
_client.cKey = "";
5959
_client.cAccept = "";
60-
_client.cProtocol = "";
60+
_client.cProtocol = protocol;
6161
_client.cExtensions = "";
6262
_client.cVersion = 0;
6363

@@ -72,19 +72,19 @@ void WebSocketsClient::begin(const char *host, uint16_t port, const char * url)
7272
#endif
7373
}
7474

75-
void WebSocketsClient::begin(String host, uint16_t port, String url) {
76-
begin(host.c_str(), port, url.c_str());
75+
void WebSocketsClient::begin(String host, uint16_t port, String url, String protocol) {
76+
begin(host.c_str(), port, url.c_str(), protocol.c_str());
7777
}
7878

7979
#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266)
80-
void WebSocketsClient::beginSSL(const char *host, uint16_t port, const char * url, const char * fingerprint) {
81-
begin(host, port, url);
80+
void WebSocketsClient::beginSSL(const char *host, uint16_t port, const char * url, const char * fingerprint, const char * protocol) {
81+
begin(host, port, url, protocol);
8282
_client.isSSL = true;
8383
_fingerprint = fingerprint;
8484
}
8585

86-
void WebSocketsClient::beginSSL(String host, uint16_t port, String url, String fingerprint) {
87-
beginSSL(host.c_str(), port, url.c_str(), fingerprint.c_str());
86+
void WebSocketsClient::beginSSL(String host, uint16_t port, String url, String fingerprint, String protocol) {
87+
beginSSL(host.c_str(), port, url.c_str(), fingerprint.c_str(), protocol.c_str());
8888
}
8989
#endif
9090

@@ -367,7 +367,7 @@ void WebSocketsClient::sendHeader(WSclient_t * client) {
367367
"Connection: Upgrade\r\n"
368368
"User-Agent: arduino-WebSocket-Client\r\n"
369369
"Sec-WebSocket-Version: 13\r\n"
370-
"Sec-WebSocket-Protocol: arduino\r\n"
370+
"Sec-WebSocket-Protocol: " + client->cProtocol +"\r\n"
371371
"Sec-WebSocket-Key: " + client->cKey + "\r\n";
372372

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

src/WebSocketsClient.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ 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)
43-
void beginSSL(const char *host, uint16_t port, const char * url = "/", const char * = "");
44-
void beginSSL(String host, uint16_t port, String url = "/", String fingerprint = "");
43+
void beginSSL(const char *host, uint16_t port, const char * url = "/", const char * = "", const char * protocol = "arduino");
44+
void beginSSL(String host, uint16_t port, String url = "/", String fingerprint = "", String protocol = "arduino");
4545
#endif
4646

4747
#if (WEBSOCKETS_NETWORK_TYPE != NETWORK_ESP8266_ASYNC)

0 commit comments

Comments
 (0)
0