fastdo  0.6.16
http::old_v1::ws::WsHttpServer< _ClientCtx > 模板类 参考

WsHTTP服务端 更多...

#include <http_old.hpp>

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

Public 类型

using ClientCtxSharedPointer = typename eiennet::old_v1::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
 
http::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 http::old_v1::ws::WsHttpServer< _ClientCtx >

WsHTTP服务端

在文件 http_old.hpp416 行定义.

成员类型定义说明

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

在文件 http_old.hpp419 行定义.

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

在文件 http_old.hpp421 行定义.

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

在文件 http_old.hpp422 行定义.

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

在文件 http_old.hpp423 行定义.

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

在文件 http_old.hpp424 行定义.

template<class _ClientCtx = WsHttpClientCtx>
using http::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 ) >

在文件 http_old.hpp426 行定义.

构造及析构函数说明

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

在文件 http_old.hpp430 行定义.

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

在文件 http_old.hpp437 行定义.

成员函数说明

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

设置动态页面处理

在文件 http_old.hpp444 行定义.

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

设置WebSocket打开事件处理

在文件 http_old.hpp447 行定义.

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

设置WebSocket消息到达事件处理

在文件 http_old.hpp449 行定义.

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

设置WebSocket关闭事件处理

在文件 http_old.hpp451 行定义.

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

设置WebSocket出错事件处理

在文件 http_old.hpp453 行定义.

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

在文件 http_old.hpp457 行定义.

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

在文件 http_old.hpp465 行定义.

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

在文件 http_old.hpp532 行定义.

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

在文件 http_old.hpp579 行定义.

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

在文件 http_old.hpp645 行定义.

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

在文件 http_old.hpp677 行定义.

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

在文件 http_old.hpp746 行定义.

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

在文件 http_old.hpp912 行定义.

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

在文件 http_old.hpp1036 行定义.

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

在文件 http_old.hpp1041 行定义.

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

在文件 http_old.hpp1046 行定义.

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

在文件 http_old.hpp1051 行定义.

类成员变量说明

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

在文件 http_old.hpp428 行定义.

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

在文件 http_old.hpp1056 行定义.

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

在文件 http_old.hpp1057 行定义.

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

在文件 http_old.hpp1058 行定义.

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

在文件 http_old.hpp1059 行定义.

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

在文件 http_old.hpp1061 行定义.

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

在文件 http_old.hpp1062 行定义.


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