mirror of
https://github.com/me-no-dev/ESPAsyncWebServer.git
synced 2025-07-29 18:27:34 +02:00
Added WS_PING event
This commit is contained in:
@ -568,10 +568,11 @@ void AsyncWebSocketClient::_onData(void* pbuf, size_t plen) {
|
||||
_queueControl(WS_DISCONNECT, data, datalen);
|
||||
}
|
||||
} else if (_pinfo.opcode == WS_PING) {
|
||||
_server->_handleEvent(this, WS_EVT_PING, NULL, NULL, 0);
|
||||
_queueControl(WS_PONG, data, datalen);
|
||||
} else if (_pinfo.opcode == WS_PONG) {
|
||||
if (datalen != AWSC_PING_PAYLOAD_LEN || memcmp(AWSC_PING_PAYLOAD, data, AWSC_PING_PAYLOAD_LEN) != 0)
|
||||
_server->_handleEvent(this, WS_EVT_PONG, NULL, data, datalen);
|
||||
_server->_handleEvent(this, WS_EVT_PONG, NULL, NULL, 0);
|
||||
} else if (_pinfo.opcode < WS_DISCONNECT) { // continuation or text/binary frame
|
||||
_server->_handleEvent(this, WS_EVT_DATA, (void*)&_pinfo, data, datalen);
|
||||
if (_pinfo.final)
|
||||
|
@ -104,6 +104,7 @@ typedef enum { WS_MSG_SENDING,
|
||||
WS_MSG_ERROR } AwsMessageStatus;
|
||||
typedef enum { WS_EVT_CONNECT,
|
||||
WS_EVT_DISCONNECT,
|
||||
WS_EVT_PING,
|
||||
WS_EVT_PONG,
|
||||
WS_EVT_ERROR,
|
||||
WS_EVT_DATA } AwsEventType;
|
||||
|
Reference in New Issue
Block a user