@@ -26,7 +26,7 @@ WebSocketClient::WebSocketClient(Client& aClient, const IPAddress& aServerAddres
26
26
{
27
27
}
28
28
29
- int WebSocketClient::begin (const char * aPath)
29
+ int WebSocketClient::begin (const char * aPath, const char * protocol= NULL )
30
30
{
31
31
// start the GET request
32
32
beginRequest ();
@@ -51,6 +51,9 @@ int WebSocketClient::begin(const char* aPath)
51
51
sendHeader (" Connection" , " Upgrade" );
52
52
sendHeader (" Sec-WebSocket-Key" , base64RandomKey);
53
53
sendHeader (" Sec-WebSocket-Version" , " 13" );
54
+ if (protocol) {
55
+ sendHeader (" Sec-WebSocket-Protocol" , protocol);
56
+ }
54
57
endRequest ();
55
58
56
59
status = responseStatusCode ();
@@ -67,9 +70,19 @@ int WebSocketClient::begin(const char* aPath)
67
70
return (status == 101 ) ? 0 : status;
68
71
}
69
72
73
+ int WebSocketClient::begin (const String& aPath, const String& protocol)
74
+ {
75
+ return begin (aPath, protocol);
76
+ }
77
+
78
+ int WebSocketClient::begin (const char * aPath)
79
+ {
80
+ return begin (aPath, NULL );
81
+ }
82
+
70
83
int WebSocketClient::begin (const String& aPath)
71
84
{
72
- return begin (aPath.c_str ());
85
+ return begin (aPath.c_str (), NULL );
73
86
}
74
87
75
88
int WebSocketClient::beginMessage (int aType)
0 commit comments