8000 allow usage of IPAddress #230 · blackhack/arduinoWebSockets@486a612 · GitHub
[go: up one dir, main page]

Skip to content

Commit 486a612

Browse files
committed
allow usage of IPAddress Links2004#230
1 parent ea8e81c commit 486a612

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

src/WebSockets.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#define bit(b) (1UL << (b)) // Taken directly from Arduino.h
3131
#else
3232
#include <Arduino.h>
33+
#include <IPAddress.h>
3334
#endif
3435

3536
#include <functional>

src/WebSocketsClient.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ void WebSocketsClient::begin(String host, uint16_t port, String url, String prot
8484
begin(host.c_str(), port, url.c_str(), protocol.c_str());
8585
}
8686

87+
void WebSocketsClient::begin(IPAddress host, uint16_t port, const char * url, const char * protocol) {
88+
return begin(host.toString().c_str(), port, url, protocol);
89+
}
90+
8791
#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP32)
8892
void WebSocketsClient::beginSSL(const char *host, uint16_t port, const char * url, const char * fingerprint, const char * protocol) {
8993
begin(host, port, url, protocol);

src/WebSocketsClient.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class WebSocketsClient: private WebSockets {
4141

4242
void begin(const char *host, uint16_t port, const char * url = "/", const char * protocol = "arduino");
4343
void begin(String host, uint16_t port, String url = "/", String protocol = "arduino");
44+
void begin(IPAddress host, uint16_t port, const char * url = "/", const char * protocol = "arduino");
4445

4546
#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP32)
4647
void beginSSL(const char *host, uint16_t port, const char * url = "/", const char * = "", const char * protocol = "arduino");

0 commit comments

Comments
 (0)
0