MCPcopy Create free account
hub / github.com/JoaoLopesF/RemoteDebug / begin

Method begin

src/utility/WebSocketsClient.cpp:42–81  ·  view source on GitHub ↗

* calles to init the Websockets server */

Source from the content-addressed store, hash-verified

40 * calles to init the Websockets server
41 */
42void WebSocketsClient::begin(const char *host, uint16_t port, const char * url, const char * protocol) {
43 _host = host;
44 _port = port;
45#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP32)
46 _fingerprint = "";
47#endif
48
49 _client.num = 0;
50 _client.status = WSC_NOT_CONNECTED;
51 _client.tcp = NULL;
52#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP32)
53 _client.isSSL = false;
54 _client.ssl = NULL;
55#endif
56 _client.cUrl = url;
57 _client.cCode = 0;
58 _client.cIsUpgrade = false;
59 _client.cIsWebsocket = true;
60 _client.cKey = "";
61 _client.cAccept = "";
62 _client.cProtocol = protocol;
63 _client.cExtensions = "";
64 _client.cVersion = 0;
65 _client.base64Authorization = "";
66 _client.plainAuthorization = "";
67 _client.isSocketIO = false;
68
69#ifdef ESP8266
70 randomSeed(RANDOM_REG32);
71#else
72 // todo find better seed
73 randomSeed(millis());
74#endif
75#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266_ASYNC)
76 asyncConnect();
77#endif
78
79 _lastConnectionFail = 0;
80 _reconnectInterval = 500;
81}
82
83void WebSocketsClient::begin(String host, uint16_t port, String url, String protocol) {
84 begin(host.c_str(), port, url.c_str(), protocol.c_str());

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected