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

Method WebSocketsServer

src/utility/WebSocketsServer.cpp:28–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26#include "WebSocketsServer.h"
27
28WebSocketsServer::WebSocketsServer(uint16_t port, String origin, String protocol) {
29 _port = port;
30 _origin = origin;
31 _protocol = protocol;
32 _runnning = false;
33
34 _server = new WEBSOCKETS_NETWORK_SERVER_CLASS(port);
35
36#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266_ASYNC)
37 _server->onClient([](void *s, AsyncClient* c){
38 ((WebSocketsServer*)s)->newClient(new AsyncTCPbuffer(c));
39 }, this);
40#endif
41
42 _cbEvent = NULL;
43
44 _httpHeaderValidationFunc = NULL;
45 _mandatoryHttpHeaders = NULL;
46 _mandatoryHttpHeaderCount = 0;
47
48 memset(&_clients[0], 0x00, (sizeof(WSclient_t) * WEBSOCKETS_SERVER_CLIENT_MAX));
49}
50
51
52WebSocketsServer::~WebSocketsServer() {

Callers

nothing calls this directly

Calls 1

newClientMethod · 0.80

Tested by

no test coverage detected