Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: SNICInterface_mod WebSocketServer mbed-rtos mbed PowerControl C12832
WebSocketServer.h
- Committer:
- flatbird
- Date:
- 2015-03-13
- Revision:
- 1:84af7a219830
- Parent:
- 0:f7596ed7ab5c
- Child:
- 5:ce3f1dd90068
File content as of revision 1:84af7a219830:
#ifndef _WEB_SOCKET_SERVER_H_
#define _WEB_SOCKET_SERVER_H_
#include "TCPSocketServer.h"
class WebSocketHandler
{
public:
virtual void onOpen() = 0;
virtual void onClose() = 0;
virtual void onMessage() = 0;
virtual void onError() = 0;
};
class WebSocketServer
{
public:
WebSocketServer();
virtual ~WebSocketServer();
bool init(int port);
void run();
bool setHandler(const char* path, WebSocketHandler* handler);
private:
bool handleHTTP(char* buf, int size);
bool handleWebSocket(char* buf, int size);
TCPSocketServer mTCPSocketServer;
};
#endif