mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-13 11:41:44 +08:00
单独提供websocket服务器程序
This commit is contained in:
@@ -199,37 +199,5 @@ private:
|
||||
std::shared_ptr<SessionImp> _session;
|
||||
};
|
||||
|
||||
/**
|
||||
* 回显会话
|
||||
*/
|
||||
class EchoSession : public TcpSession {
|
||||
public:
|
||||
EchoSession(const Socket::Ptr &pSock) : TcpSession(pSock){
|
||||
DebugL;
|
||||
}
|
||||
virtual ~EchoSession(){
|
||||
DebugL;
|
||||
}
|
||||
|
||||
void attachServer(const TcpServer &server) override{
|
||||
DebugL << getIdentifier() << " " << TcpSession::getIdentifier();
|
||||
}
|
||||
void onRecv(const Buffer::Ptr &buffer) override {
|
||||
//回显数据
|
||||
send(buffer);
|
||||
}
|
||||
void onError(const SockException &err) override{
|
||||
WarnL << err.what();
|
||||
}
|
||||
//每隔一段时间触发,用来做超时管理
|
||||
void onManager() override{
|
||||
DebugL;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
typedef WebSocketSession<EchoSession,HttpSession> EchoWebSocketSession;
|
||||
typedef WebSocketSession<EchoSession,HttpsSession> SSLEchoWebSocketSession;
|
||||
|
||||
|
||||
#endif //ZLMEDIAKIT_WEBSOCKETSESSION_H
|
||||
|
||||
Reference in New Issue
Block a user