![]() |
Qore WebSocketHandler Module Reference 2.0
|
this class represents a connection to a websocket client More...
Public Member Functions | |
| connectionClosed () | |
| This method is called when the connection is closed. | |
| constructor (WebSocketHandler handler) | |
| the constructor is called when a new connection is made by a websocket client | |
| flush () | |
| Flush all output data. | |
| gotMessage (binary msg) | |
| This method is called when messages from the client are received. | |
| gotMessage (string msg) | |
| This method is called when messages from the client are received. | |
| int | gotRawMessage (hash< WsMsgInfo > msg) |
| This method is called when a message is received. | |
| *binary | pollData () |
| This method is called to poll for messages from the client to send from the server. | |
| *binary | pollDataImmediate () |
| This method is called to poll for messages from the client to send from the server. | |
| registered () | |
| Called when the connection has been registered in handler and accept sending messages. | |
| send (data msg) | |
| Pushes an unencoded message on the connection's message queue. | |
| send (data msg, int op, bool fin) | |
| Pushes an unencoded message on the connection's message queue. | |
| sendEncoded (binary msg) | |
| Pushes an already-encoded message on the connection's message queue. | |
| setSocket (Socket sock) | |
| Sets the socket used by the server for the connection. | |
| stop () | |
| force closing socket related to connection | |
Public Attributes | |
| WebSocketHandler | handler |
| The parent handler object. | |
| bool | stop_flag = False |
| Stop connection flag. | |
Protected Member Functions | |
| Qore::Thread::Queue | queue () |
| the Queue object stores messages to be sent to the server | |
Protected Attributes | |
| int | tid = gettid() |
| The TID of the I/O thread. | |
Private Attributes | |
| Socket | sock |
| The socket used by the server for this connection. | |
this class represents a connection to a websocket client
| WebSocketHandler::WebSocketConnection::connectionClosed | ( | ) |
This method is called when the connection is closed.
Called by the WebSocketHandler
The implementation in this class is empty; implement this method in a subclass to provide custom behavior
| WebSocketHandler::WebSocketConnection::constructor | ( | WebSocketHandler | handler | ) |
the constructor is called when a new connection is made by a websocket client
Called from WebSocketHandler::getConnectionImpl(), which can be overridden in subclasses to allow a subclass of this class to be used as the connection object
| WebSocketHandler::WebSocketConnection::flush | ( | ) |
Flush all output data.
| WebSocketHandler::WebSocketConnection::gotMessage | ( | binary | msg | ) |
This method is called when messages from the client are received.
Called by the WebSocketHandler
The implementation in this class is empty; implement this method in a subclass to provide custom behavior
| WebSocketHandler::WebSocketConnection::gotMessage | ( | string | msg | ) |
This method is called when messages from the client are received.
Called by the WebSocketHandler
The implementation in this class is empty; implement this method in a subclass to provide custom behavior
| int WebSocketHandler::WebSocketConnection::gotRawMessage | ( | hash< WsMsgInfo > | msg | ) |
This method is called when a message is received.
| msg | the raw message information |
| *binary WebSocketHandler::WebSocketConnection::pollData | ( | ) |
This method is called to poll for messages from the client to send from the server.
Called by the WebSocketHandler
| *binary WebSocketHandler::WebSocketConnection::pollDataImmediate | ( | ) |
This method is called to poll for messages from the client to send from the server.
Called by the WebSocketHandler
| WebSocketHandler::WebSocketConnection::registered | ( | ) |
Called when the connection has been registered in handler and accept sending messages.
Can be used to send initial welcome message, for example; the default implementation does nothing
| WebSocketHandler::WebSocketConnection::send | ( | data | msg | ) |
Pushes an unencoded message on the connection's message queue.
The message will be encoded with WebSocketUtil::ws_encode_message() before sending
| WebSocketHandler::WebSocketConnection::send | ( | data | msg, |
| int | op, | ||
| bool | fin ) |
Pushes an unencoded message on the connection's message queue.
The message will be encoded with WebSocketUtil::ws_encode_message() before sending