Crow  0.3
A C++ microframework for the web
crow::WebSocketRule Class Reference

A rule dealing with websockets. More...

#include <routing.h>

Inheritance diagram for crow::WebSocketRule:
crow::BaseRule

Public Member Functions

 WebSocketRule (std::string rule)
 
void validate () override
 
void handle (const request &, response &res, const routing_params &) override
 
void handle_upgrade (const request &req, response &, SocketAdaptor &&adaptor) override
 
template<typename Func >
self_tonopen (Func f)
 
template<typename Func >
self_tonmessage (Func f)
 
template<typename Func >
self_tonclose (Func f)
 
template<typename Func >
self_tonerror (Func f)
 
template<typename Func >
self_tonaccept (Func f)
 
- Public Member Functions inherited from crow::BaseRule
 BaseRule (std::string rule)
 
std::unique_ptr< BaseRuleupgrade ()
 
uint32_t get_methods ()
 
template<typename F >
void foreach_method (F f)
 
const std::string & rule ()
 

Protected Attributes

std::function< void(crow::websocket::connection &)> open_handler_
 
std::function< void(crow::websocket::connection &, const std::string &, bool)> message_handler_
 
std::function< void(crow::websocket::connection &, const std::string &)> close_handler_
 
std::function< void(crow::websocket::connection &)> error_handler_
 
std::function< bool(const crow::request &)> accept_handler_
 
- Protected Attributes inherited from crow::BaseRule
uint32_t methods_ {1<<static_cast<int>(HTTPMethod::Get)}
 
std::string rule_
 
std::string name_
 
std::unique_ptr< BaseRulerule_to_upgrade_
 

Detailed Description

A rule dealing with websockets.

Provides the interface for the user to put in the necessary handlers for a websocket to work.


The documentation for this class was generated from the following file: