Simple WebSocket server library.
Dependents: WebSocketServerTest
WebSocketConnection.h@2:db41b4e0d64b, 2015-04-06 (annotated)
- Committer:
- flatbird
- Date:
- Mon Apr 06 12:55:41 2015 +0000
- Revision:
- 2:db41b4e0d64b
- Parent:
- 0:a816c25e83ed
add LICENSE.txt (MIT License)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
flatbird | 0:a816c25e83ed | 1 | #ifndef _WEB_SOCKET_CONNECTION_H_ |
flatbird | 0:a816c25e83ed | 2 | #define _WEB_SOCKET_CONNECTION_H_ |
flatbird | 0:a816c25e83ed | 3 | |
flatbird | 0:a816c25e83ed | 4 | #include "TCPSocketServer.h" |
flatbird | 0:a816c25e83ed | 5 | #include "WebSocketHandler.h" |
flatbird | 0:a816c25e83ed | 6 | #include <string> |
flatbird | 0:a816c25e83ed | 7 | #include <map> |
flatbird | 0:a816c25e83ed | 8 | |
flatbird | 0:a816c25e83ed | 9 | class WebSocketServer; |
flatbird | 0:a816c25e83ed | 10 | |
flatbird | 0:a816c25e83ed | 11 | class WebSocketConnection |
flatbird | 0:a816c25e83ed | 12 | { |
flatbird | 0:a816c25e83ed | 13 | public: |
flatbird | 0:a816c25e83ed | 14 | WebSocketConnection(WebSocketServer* server); |
flatbird | 0:a816c25e83ed | 15 | virtual ~WebSocketConnection(); |
flatbird | 0:a816c25e83ed | 16 | |
flatbird | 0:a816c25e83ed | 17 | void run(); |
flatbird | 0:a816c25e83ed | 18 | TCPSocketConnection& getTCPSocketConnection() { return mConnection; } |
flatbird | 0:a816c25e83ed | 19 | |
flatbird | 0:a816c25e83ed | 20 | private: |
flatbird | 0:a816c25e83ed | 21 | bool handleHTTP(char* buf, int size); |
flatbird | 0:a816c25e83ed | 22 | bool handleWebSocket(char* buf, int size); |
flatbird | 0:a816c25e83ed | 23 | bool sendUpgradeResponse(char* key); |
flatbird | 0:a816c25e83ed | 24 | |
flatbird | 0:a816c25e83ed | 25 | WebSocketServer* mServer; |
flatbird | 0:a816c25e83ed | 26 | TCPSocketConnection mConnection; |
flatbird | 0:a816c25e83ed | 27 | WebSocketHandler* mHandler; |
flatbird | 0:a816c25e83ed | 28 | bool mPrevFin; |
flatbird | 0:a816c25e83ed | 29 | }; |
flatbird | 0:a816c25e83ed | 30 | |
flatbird | 0:a816c25e83ed | 31 | #endif |