Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of libMiMic by
ModWebSocket Class Reference
This class is Websocket module. More...
#include <ModWebSocket.h>
Inherits MiMic::ModBaseClass.
Public Member Functions | |
bool | execute (HttpdConnection &i_connection) |
This function executes websocket negotiation to the current connection. | |
bool | write (const void *i_tx_buf, int i_tx_size) |
Write data to websocket stream. | |
bool | writeFormat (const char *i_fmt,...) |
This function sends data to websocket stream. | |
int | read (void *i_rx_buf, int i_rx_size) |
This function receives data from websocket stream. | |
void | close () |
This function terminates websocket connection. | |
bool | canRead () |
This function returns read function status. | |
Private Member Functions | |
virtual bool | canHandle (HttpdConnection &i_connection) |
URLとパスプレフィクスi_pathを比較して、処理対象のURLかを計算します。 URLに'/i_path/'を含むパスを処理対象とみなします。 |
Detailed Description
This class is Websocket module.
The class provides 3 services.
- d.xml - a device description.
- control/xx - soap handler
- event/xx -event handler.
Definition at line 21 of file ModWebSocket.h.
Member Function Documentation
bool canRead | ( | ) |
This function returns read function status.
This is to confirm that "read" can call without blocking.
- Returns:
- true if can be call "read" with no-wait. otherwise, "read" might be wait.
Definition at line 88 of file ModWebSocket.cpp.
void close | ( | ) |
This function terminates websocket connection.
Should be called if execute function successful.
Definition at line 96 of file ModWebSocket.cpp.
bool execute | ( | HttpdConnection & | i_connection ) |
This function executes websocket negotiation to the current connection.
Should be handle websocket session if function successful.
- Returns:
- true if negotiation successful;otherwishe false.
Definition at line 32 of file ModWebSocket.cpp.
int read | ( | void * | i_rx_buf, |
int | i_rx_size | ||
) |
This function receives data from websocket stream.
- Returns:
- r<0 Error. The socket already closed.
- r==0 Timeout. The connection is continued.
- r>0 Success. Received data size.
Definition at line 80 of file ModWebSocket.cpp.
bool write | ( | const void * | i_tx_buf, |
int | i_tx_size | ||
) |
Write data to websocket stream.
- Returns:
- true if successful;otherwishe false and connection closed.
Definition at line 59 of file ModWebSocket.cpp.
bool writeFormat | ( | const char * | i_fmt, |
... | |||
) |
This function sends data to websocket stream.
- Parameters:
-
i_fmt printf like format text. ... argument list for i_fmt
Definition at line 69 of file ModWebSocket.cpp.
Generated on Tue Jul 12 2022 16:23:00 by
