Merge remote-tracking branch 'remotes/origin/master' into async

Conflicts:
	src/WebSockets.h
This commit is contained in:
Markus Sattler
2016-01-29 13:22:15 +01:00
2 changed files with 13 additions and 13 deletions

View File

@ -37,7 +37,7 @@ WebSocketsClient::~WebSocketsClient() {
/** /**
* calles to init the Websockets server * 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; _host = host;
_port = port; _port = port;
#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266) #if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266)
@ -57,7 +57,7 @@ void WebSocketsClient::begin(const char *host, uint16_t port, const char * url)
_client.cIsWebsocket = true; _client.cIsWebsocket = true;
_client.cKey = ""; _client.cKey = "";
_client.cAccept = ""; _client.cAccept = "";
_client.cProtocol = ""; _client.cProtocol = protocol;
_client.cExtensions = ""; _client.cExtensions = "";
_client.cVersion = 0; _client.cVersion = 0;
@ -72,19 +72,19 @@ void WebSocketsClient::begin(const char *host, uint16_t port, const char * url)
#endif #endif
} }
void WebSocketsClient::begin(String host, uint16_t port, String url) { void WebSocketsClient::begin(String host, uint16_t port, String url, String protocol) {
begin(host.c_str(), port, url.c_str()); begin(host.c_str(), port, url.c_str(), protocol.c_str());
} }
#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266) #if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266)
void WebSocketsClient::beginSSL(const char *host, uint16_t port, const char * url, const char * fingerprint) { void WebSocketsClient::beginSSL(const char *host, uint16_t port, const char * url, const char * fingerprint, const char * protocol) {
begin(host, port, url); begin(host, port, url, protocol);
_client.isSSL = true; _client.isSSL = true;
_fingerprint = fingerprint; _fingerprint = fingerprint;
} }
void WebSocketsClient::beginSSL(String host, uint16_t port, String url, String fingerprint) { void WebSocketsClient::beginSSL(String host, uint16_t port, String url, String fingerprint, String protocol) {
beginSSL(host.c_str(), port, url.c_str(), fingerprint.c_str()); beginSSL(host.c_str(), port, url.c_str(), fingerprint.c_str(), protocol.c_str());
} }
#endif #endif
@ -367,7 +367,7 @@ void WebSocketsClient::sendHeader(WSclient_t * client) {
"Connection: Upgrade\r\n" "Connection: Upgrade\r\n"
"User-Agent: arduino-WebSocket-Client\r\n" "User-Agent: arduino-WebSocket-Client\r\n"
"Sec-WebSocket-Version: 13\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"; "Sec-WebSocket-Key: " + client->cKey + "\r\n";
if(client->cExtensions.length() > 0) { if(client->cExtensions.length() > 0) {

View File

@ -36,12 +36,12 @@ class WebSocketsClient: private WebSockets {
WebSocketsClient(void); WebSocketsClient(void);
~WebSocketsClient(void); ~WebSocketsClient(void);
void begin(const char *host, uint16_t port, const char * url = "/"); void begin(const char *host, uint16_t port, const char * url = "/", const char * protocol = "arduino");
void begin(String host, uint16_t port, String url = "/"); void begin(String host, uint16_t port, String url = "/", String protocol = "arduino");
#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266) #if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266)
void beginSSL(const char *host, uint16_t port, const char * url = "/", const char * = ""); void beginSSL(const char *host, uint16_t port, const char * url = "/", const char * = "", const char * protocol = "arduino");
void beginSSL(String host, uint16_t port, String url = "/", String fingerprint = ""); void beginSSL(String host, uint16_t port, String url = "/", String fingerprint = "", String protocol = "arduino");
#endif #endif
#if (WEBSOCKETS_NETWORK_TYPE != NETWORK_ESP8266_ASYNC) #if (WEBSOCKETS_NETWORK_TYPE != NETWORK_ESP8266_ASYNC)