Qore WebSocketHandler Module Reference: WebSocketHandler::WebSocketConnection Class Reference

Qore WebSocketHandler Module Reference 1.0

- Main Page
- Related Pages
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Functions Variables Groups Pages
Public Member Functions | Private Member Functions | List of all members
WebSocketHandler::WebSocketConnection Class Reference

this class represents a connection to a websocket client More...

## Public Member Functions
| constructor (WebSocketHandler handler)
| the constructor is called by the WebSocketHandler when a new connection is made by a websocket client; it is called from WebSocketHandler::getConnectionImpl(), which can be overridden in subclasses to allow a subclass of this class to be used as the connection object
| gotMessage (string msg)
| this method is called by the WebSocketHandler when messages from the client are received
| gotMessage (binary msg)
| this method is called by the WebSocketHandler when messages from the client are received
*binary | pollData ()
| this method is called by the WebSocketHandler to poll for messages from the client to send from the server
*binary | pollDataImmediate ()
| this method is called by the WebSocketHandler to poll for messages from the client to send from the server
| 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
| sendEncoded (binary msg)
| pushes an already-encoded message on the connection's message queue

## Private Member Functions
Qore::Thread::Queue | queue ()
| the Queue object stored messages to be sent to the server

## Detailed Description

this class represents a connection to a websocket client

Receiving WebSocket Messages from Clients
  When the WebSocketHandler class receives a message from the client, the WebSocketHandler class calls the WebSocketConnection::gotMessage() on the object that represents that connection.

Sending WebSocket Message to Clients
  To send a message to a websocket client, call one of the following methods:
  - WebSocketConnection::send(): to send an unencoded message to the client
  - WebSocketConnection::sendEncoded(): to send an already-encoded message to the client