ESP32 HTTPS Server: httpsserver::WebsocketHandler Class Reference
Public Member Functions | |
| virtual void | onClose () |
| The default onClose handler. If no over-riding handler is provided for the "close" event, this method is called. | |
| virtual void | onMessage (WebsocketInputStreambuf *pWebsocketInputStreambuf) |
| The default onData handler. If no over-riding handler is provided for the "message" event, this method is called. A particularly useful pattern for using onMessage is: std::stringstream buffer; buffer << pWebSocketInputRecordStreambuf; This will read the whole message into the string stream. | |
| virtual void | onError (std::string error) |
| The default onError handler. If no over-riding handler is provided for the "error" event, this method is called. | |
| void | close (uint16_t status=CLOSE_NORMAL_CLOSURE, std::string message="") |
| Close the Web socket. More... | |
| void | send (std::string data, uint8_t sendType=SEND_TYPE_BINARY) |
| Send data down the web socket See the WebSocket spec (RFC6455) section "6.1 Sending Data". We build a WebSocket frame, send the frame followed by the data. More... | |
| void | send (uint8_t *data, uint16_t length, uint8_t sendType=SEND_TYPE_BINARY) |
| Send data down the web socket See the WebSocket spec (RFC6455) section "6.1 Sending Data". We build a WebSocket frame, send the frame followed by the data. More... | |
| bool | closed () |
| void | loop () |
| void | initialize (ConnectionContext *con) |
◆ close()
| void httpsserver::WebsocketHandler::close | ( | uint16_t | status = CLOSE_NORMAL_CLOSURE, |
| std::string | message = "" |
||
| ) |
Close the Web socket.
- Parameters
-
[in] status The code passed in the close request. [in] message A clarification message on the close request.
◆ closed()
| bool httpsserver::WebsocketHandler::closed | ( | ) |
Returns true if the connection has been closed, either by client or server
◆ send() [1/2]
| void httpsserver::WebsocketHandler::send | ( | std::string | data, |
| uint8_t | sendType = SEND_TYPE_BINARY |
||
| ) |
Send data down the web socket See the WebSocket spec (RFC6455) section "6.1 Sending Data". We build a WebSocket frame, send the frame followed by the data.
- Parameters
-
[in] data The data to send down the WebSocket. [in] sendType The type of payload. Either SEND_TYPE_TEXT or SEND_TYPE_BINARY.
◆ send() [2/2]
| void httpsserver::WebsocketHandler::send | ( | uint8_t * | data, |
| uint16_t | length, | ||
| uint8_t | sendType = SEND_TYPE_BINARY |
||
| ) |
Send data down the web socket See the WebSocket spec (RFC6455) section "6.1 Sending Data". We build a WebSocket frame, send the frame followed by the data.
- Parameters
-
[in] data The data to send down the WebSocket. [in] sendType The type of payload. Either SEND_TYPE_TEXT or SEND_TYPE_BINARY.
The documentation for this class was generated from the following files:
- /home/frank/Projekte/esp32/https_server/esp32_https_server/src/WebsocketHandler.hpp
- /home/frank/Projekte/esp32/https_server/esp32_https_server/src/WebsocketHandler.cpp