Implementation of SubscriptionContextInterface.
More...
#include <SubscriptionContext.hpp>
|
using | ErrorHandler = std::function<bool(Error const&, Connection const&)> |
| Error handler definition. Error handler returns true if connection should be closed false otherwise.
|
|
using | OnDisconnectSlot = std::function<void(SubscriptionContextInterface*)> |
| Alias for on disconnect slot.
|
|
Implementation of SubscriptionContextInterface.
- Note
- This class is designed to be used with SubscriptionManager. The class is safe to use from multiple threads. The method disconnect() must be called before the object is destroyed.
◆ SubscriptionContext()
Construct a new Subscription Context object.
- Parameters
-
factory | The tag decorator factory to use to init taggable. |
connection | The connection for which the context is created. |
maxSendQueueSize | The maximum size of the send queue. If the queue is full, the connection will be closed. |
yield | The yield context to spawn sending coroutines. |
errorHandler | The error handler. |
◆ apiSubversion()
uint32_t web::ng::SubscriptionContext::apiSubversion |
( |
| ) |
const |
|
overridevirtual |
◆ disconnect()
void web::ng::SubscriptionContext::disconnect |
( |
boost::asio::yield_context | yield | ) |
|
Notify the context that related connection is disconnected and wait for all the task to complete.
- Note
- This method must be called before the object is destroyed.
- Parameters
-
yield | The yield context to wait for all the tasks to complete. |
◆ onDisconnect()
void web::ng::SubscriptionContext::onDisconnect |
( |
OnDisconnectSlot const & | slot | ) |
|
|
overridevirtual |
◆ send()
void web::ng::SubscriptionContext::send |
( |
std::shared_ptr< std::string > | message | ) |
|
|
overridevirtual |
Send message to the client.
- Note
- This method does nothing after disconnected() was called.
- Parameters
-
message | The message to send. |
Implements web::SubscriptionContextInterface.
◆ setApiSubversion()
void web::ng::SubscriptionContext::setApiSubversion |
( |
uint32_t | value | ) |
|
|
overridevirtual |
The documentation for this class was generated from the following files: