Simple WebSocket server library.
Dependents: WebSocketServerTest
Diff: WebSocketServer.h
- Revision:
- 0:a816c25e83ed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/WebSocketServer.h Mon Mar 16 10:13:30 2015 +0000 @@ -0,0 +1,27 @@ +#ifndef _WEB_SOCKET_SERVER_H_ +#define _WEB_SOCKET_SERVER_H_ + +#include "TCPSocketServer.h" +#include "WebSocketHandler.h" +#include <string> +#include <map> + +class WebSocketServer +{ +public: + WebSocketServer(); + virtual ~WebSocketServer(); + + bool init(int port); + void run(); + void setHandler(const char* path, WebSocketHandler* handler); + WebSocketHandler* getHandler(const char* path); + +private: + typedef std::map<std::string, WebSocketHandler*> WebSocketHandlerContainer; + + TCPSocketServer mTCPSocketServer; + WebSocketHandlerContainer mHandlers; +}; + +#endif