fastdo  0.6.8
eiennet::old_v1::ws::WsHttpServer< _ClientCtx > 模板类 参考

WsHTTP服务端 更多...

#include <eiennet_websocket.hpp>

类 eiennet::old_v1::ws::WsHttpServer< _ClientCtx > 继承关系图:
eiennet::old_v1::ws::WsHttpServer< _ClientCtx > 的协作图:

Public 类型

using ClientCtxSharedPointer = typename Server< _ClientCtx >::ClientCtxSharedPointer
 
using OpenHandlerFunction = std::function< void(ClientCtxSharedPointer clientCtxPtr) >
 
using MessageHandlerFunction = std::function< void(ClientCtxSharedPointer clientCtxPtr, winux::AnsiString const &data, int messageType) >
 
using CloseHandlerFunction = std::function< void(ClientCtxSharedPointer clientCtxPtr, winux::uint16 errCode, winux::AnsiString const &errStr) >
 
using ErrorHandlerFunction = std::function< void(ClientCtxSharedPointer clientCtxPtr, WebSocketErrorCode ec) >
 
using ResponseHandlerFunction = std::function< void(ClientCtxSharedPointer &clientCtxPtr, http::Header const &reqHdr, http::Url const &url, http::Header &rspHdr, std::ostream &rspOut) >
 
- Public 类型 继承自 eiennet::old_v1::Server< _ClientCtx >
using ClientCtxSharedPointer = winux::SharedPointer< _ClientCtx >
 
using StartupHandlerFunction = std::function< void(ClientCtxSharedPointer clientCtxPtr) >
 

Public 成员函数

 WsHttpServer (HttpServerConfig const &confObj)
 
 WsHttpServer (winux::String const &serverIp, winux::ushort port, int threadCount=10, int listenBacklog=10, double durationSec=0.1)
 
void setHandler (winux::String const &urlPath, ResponseHandlerFunction handler)
 设置动态页面处理 更多...
 
void onOpenHandler (OpenHandlerFunction handler)
 设置WebSocket打开事件处理 更多...
 
void onMessageHandler (MessageHandlerFunction handler)
 设置WebSocket消息到达事件处理 更多...
 
void onCloseHandler (CloseHandlerFunction handler)
 设置WebSocket关闭事件处理 更多...
 
void onErrorHandler (ErrorHandlerFunction handler)
 设置WebSocket出错事件处理 更多...
 
- Public 成员函数 继承自 eiennet::old_v1::Server< _ClientCtx >
 Server (ip::EndPoint const &ep, int threadCount=4, int backlog=0)
 构造函数1 更多...
 
virtual ~Server ()
 
virtual int run ()
 
void stop (bool b=true)
 是否停止服务运行 更多...
 
size_t getClientsCount () const
 
void onStartupHandler (StartupHandlerFunction handler)
 
void removeClient (winux::uint64 clientId)
 

Public 属性

HttpServerConfig config
 

Protected 成员函数

virtual void onStartup (ClientCtxSharedPointer clientCtxPtr) override
 
void _doRecvRequestHeaderTask (ClientCtxSharedPointer clientCtxPtr)
 
void _doRecvRequestBodyTask (ClientCtxSharedPointer clientCtxPtr)
 
void _doRequestTask (ClientCtxSharedPointer clientCtxPtr)
 
void _httpProcess (ClientCtxSharedPointer &clientCtxPtr, http::Header const &reqHdr, http::Url const &url, http::Header &rspHdr, std::ostream &rspOut)
 
void _webProcess (ClientCtxSharedPointer &clientCtxPtr, http::Header const &reqHdr, http::Url const &url, http::Header &rspHdr, std::ostream &rspOut)
 
void _doRecvWebSocketFrameTask (ClientCtxSharedPointer clientCtxPtr)
 
void _doProcessWebSocketFrameTask (ClientCtxSharedPointer clientCtxPtr, bool fin, winux::uint opcode, winux::Buffer &payloadData)
 
virtual void onOpen (ClientCtxSharedPointer clientCtxPtr)
 
virtual void onMessage (ClientCtxSharedPointer clientCtxPtr, winux::AnsiString const &data, int messageType)
 
virtual void onClose (ClientCtxSharedPointer clientCtxPtr, winux::uint16 errCode, winux::AnsiString const &errStr)
 
virtual void onError (ClientCtxSharedPointer clientCtxPtr, WebSocketErrorCode ec)
 
- Protected 成员函数 继承自 eiennet::old_v1::Server< _ClientCtx >
ClientCtxSharedPointer_addClient (ip::EndPoint const &clientEp, winux::SharedPointer< ip::tcp::Socket > clientSockPtr)
 
virtual void onStartup (ClientCtxSharedPointer clientCtxPtr)
 

Protected 属性

OpenHandlerFunction _openHandler
 
MessageHandlerFunction _messageHandler
 
CloseHandlerFunction _closeHandler
 
ErrorHandlerFunction _errorHandler
 
std::map< winux::String, ResponseHandlerFunction_handlers
 
StaticFileMemoryCache _cache
 
- Protected 属性 继承自 eiennet::old_v1::Server< _ClientCtx >
winux::uint64 _cumulativeClientId
 
bool _stop
 
winux::ThreadPool _pool
 
winux::Mutex _mtxServer
 
ip::tcp::Socket _servSock
 
std::map< winux::uint64, ClientCtxSharedPointer_clients
 
StartupHandlerFunction _startupHandler
 

详细描述

template<class _ClientCtx = WsHttpClientCtx>
class eiennet::old_v1::ws::WsHttpServer< _ClientCtx >

WsHTTP服务端

在文件 eiennet_websocket.hpp328 行定义.

成员类型定义说明

template<class _ClientCtx = WsHttpClientCtx>
using eiennet::old_v1::ws::WsHttpServer< _ClientCtx >::ClientCtxSharedPointer = typename Server<_ClientCtx>::ClientCtxSharedPointer

在文件 eiennet_websocket.hpp331 行定义.

template<class _ClientCtx = WsHttpClientCtx>
using eiennet::old_v1::ws::WsHttpServer< _ClientCtx >::CloseHandlerFunction = std::function< void( ClientCtxSharedPointer clientCtxPtr, winux::uint16 errCode, winux::AnsiString const & errStr ) >

在文件 eiennet_websocket.hpp335 行定义.

template<class _ClientCtx = WsHttpClientCtx>
using eiennet::old_v1::ws::WsHttpServer< _ClientCtx >::ErrorHandlerFunction = std::function< void( ClientCtxSharedPointer clientCtxPtr, WebSocketErrorCode ec ) >

在文件 eiennet_websocket.hpp336 行定义.

template<class _ClientCtx = WsHttpClientCtx>
using eiennet::old_v1::ws::WsHttpServer< _ClientCtx >::MessageHandlerFunction = std::function< void( ClientCtxSharedPointer clientCtxPtr, winux::AnsiString const & data, int messageType ) >

在文件 eiennet_websocket.hpp334 行定义.

template<class _ClientCtx = WsHttpClientCtx>
using eiennet::old_v1::ws::WsHttpServer< _ClientCtx >::OpenHandlerFunction = std::function< void( ClientCtxSharedPointer clientCtxPtr ) >

在文件 eiennet_websocket.hpp333 行定义.

template<class _ClientCtx = WsHttpClientCtx>
using eiennet::old_v1::ws::WsHttpServer< _ClientCtx >::ResponseHandlerFunction = std::function< void ( ClientCtxSharedPointer & clientCtxPtr, http::Header const & reqHdr, http::Url const & url, http::Header & rspHdr, std::ostream & rspOut ) >

在文件 eiennet_websocket.hpp338 行定义.

构造及析构函数说明

template<class _ClientCtx = WsHttpClientCtx>
eiennet::old_v1::ws::WsHttpServer< _ClientCtx >::WsHttpServer ( HttpServerConfig const &  confObj)
inline

在文件 eiennet_websocket.hpp342 行定义.

template<class _ClientCtx = WsHttpClientCtx>
eiennet::old_v1::ws::WsHttpServer< _ClientCtx >::WsHttpServer ( winux::String const &  serverIp,
winux::ushort  port,
int  threadCount = 10,
int  listenBacklog = 10,
double  durationSec = 0.1 
)
inline

在文件 eiennet_websocket.hpp349 行定义.

成员函数说明

template<class _ClientCtx = WsHttpClientCtx>
void eiennet::old_v1::ws::WsHttpServer< _ClientCtx >::_doProcessWebSocketFrameTask ( ClientCtxSharedPointer  clientCtxPtr,
bool  fin,
winux::uint  opcode,
winux::Buffer payloadData 
)
inlineprotected

在文件 eiennet_websocket.hpp824 行定义.

函数调用图:

template<class _ClientCtx = WsHttpClientCtx>
void eiennet::old_v1::ws::WsHttpServer< _ClientCtx >::_doRecvRequestBodyTask ( ClientCtxSharedPointer  clientCtxPtr)
inlineprotected

在文件 eiennet_websocket.hpp444 行定义.

函数调用图:

template<class _ClientCtx = WsHttpClientCtx>
void eiennet::old_v1::ws::WsHttpServer< _ClientCtx >::_doRecvRequestHeaderTask ( ClientCtxSharedPointer  clientCtxPtr)
inlineprotected

在文件 eiennet_websocket.hpp377 行定义.

函数调用图:

template<class _ClientCtx = WsHttpClientCtx>
void eiennet::old_v1::ws::WsHttpServer< _ClientCtx >::_doRecvWebSocketFrameTask ( ClientCtxSharedPointer  clientCtxPtr)
inlineprotected

在文件 eiennet_websocket.hpp658 行定义.

函数调用图:

template<class _ClientCtx = WsHttpClientCtx>
void eiennet::old_v1::ws::WsHttpServer< _ClientCtx >::_doRequestTask ( ClientCtxSharedPointer  clientCtxPtr)
inlineprotected

在文件 eiennet_websocket.hpp491 行定义.

函数调用图:

template<class _ClientCtx = WsHttpClientCtx>
void eiennet::old_v1::ws::WsHttpServer< _ClientCtx >::_httpProcess ( ClientCtxSharedPointer clientCtxPtr,
http::Header const &  reqHdr,
http::Url const &  url,
http::Header rspHdr,
std::ostream &  rspOut 
)
inlineprotected

在文件 eiennet_websocket.hpp557 行定义.

函数调用图:

template<class _ClientCtx = WsHttpClientCtx>
void eiennet::old_v1::ws::WsHttpServer< _ClientCtx >::_webProcess ( ClientCtxSharedPointer clientCtxPtr,
http::Header const &  reqHdr,
http::Url const &  url,
http::Header rspHdr,
std::ostream &  rspOut 
)
inlineprotected

在文件 eiennet_websocket.hpp589 行定义.

函数调用图:

template<class _ClientCtx = WsHttpClientCtx>
virtual void eiennet::old_v1::ws::WsHttpServer< _ClientCtx >::onClose ( ClientCtxSharedPointer  clientCtxPtr,
winux::uint16  errCode,
winux::AnsiString const &  errStr 
)
inlineprotectedvirtual

在文件 eiennet_websocket.hpp958 行定义.

template<class _ClientCtx = WsHttpClientCtx>
void eiennet::old_v1::ws::WsHttpServer< _ClientCtx >::onCloseHandler ( CloseHandlerFunction  handler)
inline

设置WebSocket关闭事件处理

在文件 eiennet_websocket.hpp363 行定义.

template<class _ClientCtx = WsHttpClientCtx>
virtual void eiennet::old_v1::ws::WsHttpServer< _ClientCtx >::onError ( ClientCtxSharedPointer  clientCtxPtr,
WebSocketErrorCode  ec 
)
inlineprotectedvirtual

在文件 eiennet_websocket.hpp963 行定义.

template<class _ClientCtx = WsHttpClientCtx>
void eiennet::old_v1::ws::WsHttpServer< _ClientCtx >::onErrorHandler ( ErrorHandlerFunction  handler)
inline

设置WebSocket出错事件处理

在文件 eiennet_websocket.hpp365 行定义.

template<class _ClientCtx = WsHttpClientCtx>
virtual void eiennet::old_v1::ws::WsHttpServer< _ClientCtx >::onMessage ( ClientCtxSharedPointer  clientCtxPtr,
winux::AnsiString const &  data,
int  messageType 
)
inlineprotectedvirtual

在文件 eiennet_websocket.hpp953 行定义.

template<class _ClientCtx = WsHttpClientCtx>
void eiennet::old_v1::ws::WsHttpServer< _ClientCtx >::onMessageHandler ( MessageHandlerFunction  handler)
inline

设置WebSocket消息到达事件处理

在文件 eiennet_websocket.hpp361 行定义.

template<class _ClientCtx = WsHttpClientCtx>
virtual void eiennet::old_v1::ws::WsHttpServer< _ClientCtx >::onOpen ( ClientCtxSharedPointer  clientCtxPtr)
inlineprotectedvirtual

在文件 eiennet_websocket.hpp948 行定义.

template<class _ClientCtx = WsHttpClientCtx>
void eiennet::old_v1::ws::WsHttpServer< _ClientCtx >::onOpenHandler ( OpenHandlerFunction  handler)
inline

设置WebSocket打开事件处理

在文件 eiennet_websocket.hpp359 行定义.

template<class _ClientCtx = WsHttpClientCtx>
virtual void eiennet::old_v1::ws::WsHttpServer< _ClientCtx >::onStartup ( ClientCtxSharedPointer  clientCtxPtr)
inlineoverrideprotectedvirtual

在文件 eiennet_websocket.hpp369 行定义.

函数调用图:

template<class _ClientCtx = WsHttpClientCtx>
void eiennet::old_v1::ws::WsHttpServer< _ClientCtx >::setHandler ( winux::String const &  urlPath,
ResponseHandlerFunction  handler 
)
inline

设置动态页面处理

在文件 eiennet_websocket.hpp356 行定义.

类成员变量说明

template<class _ClientCtx = WsHttpClientCtx>
StaticFileMemoryCache eiennet::old_v1::ws::WsHttpServer< _ClientCtx >::_cache
protected

在文件 eiennet_websocket.hpp974 行定义.

template<class _ClientCtx = WsHttpClientCtx>
CloseHandlerFunction eiennet::old_v1::ws::WsHttpServer< _ClientCtx >::_closeHandler
protected

在文件 eiennet_websocket.hpp970 行定义.

template<class _ClientCtx = WsHttpClientCtx>
ErrorHandlerFunction eiennet::old_v1::ws::WsHttpServer< _ClientCtx >::_errorHandler
protected

在文件 eiennet_websocket.hpp971 行定义.

template<class _ClientCtx = WsHttpClientCtx>
std::map< winux::String, ResponseHandlerFunction > eiennet::old_v1::ws::WsHttpServer< _ClientCtx >::_handlers
protected

在文件 eiennet_websocket.hpp973 行定义.

template<class _ClientCtx = WsHttpClientCtx>
MessageHandlerFunction eiennet::old_v1::ws::WsHttpServer< _ClientCtx >::_messageHandler
protected

在文件 eiennet_websocket.hpp969 行定义.

template<class _ClientCtx = WsHttpClientCtx>
OpenHandlerFunction eiennet::old_v1::ws::WsHttpServer< _ClientCtx >::_openHandler
protected

在文件 eiennet_websocket.hpp968 行定义.

template<class _ClientCtx = WsHttpClientCtx>
HttpServerConfig eiennet::old_v1::ws::WsHttpServer< _ClientCtx >::config

在文件 eiennet_websocket.hpp340 行定义.


该类的文档由以下文件生成: