ESP8266 part of the f105-motor-demo project (see f105-motor-demo_stm32)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.1 KiB

9 years ago
#ifndef CGIWEBSOCKET_H
#define CGIWEBSOCKET_H
#include "httpd.h"
#define WEBSOCK_FLAG_NONE 0
#define WEBSOCK_FLAG_CONT (1<<0) //Set if the data is not the final data in the message; more follows
#define WEBSOCK_FLAG_BIN (1<<1) //Set if the data is binary instead of text
typedef struct Websock Websock;
typedef struct WebsockPriv WebsockPriv;
typedef void(*WsConnectedCb)(Websock *ws);
typedef void(*WsRecvCb)(Websock *ws, char *data, int len, int flags);
typedef void(*WsSentCb)(Websock *ws);
typedef void(*WsCloseCb)(Websock *ws);
struct Websock {
void *userData;
HttpdConnData *conn;
uint8_t status;
WsRecvCb recvCb;
WsSentCb sentCb;
WsCloseCb closeCb;
WebsockPriv *priv;
};
httpd_cgi_state cgiWebsocket(HttpdConnData *connData);
9 years ago
int ICACHE_FLASH_ATTR cgiWebsocketSend(Websock *ws, char *data, int len, int flags);
void ICACHE_FLASH_ATTR cgiWebsocketClose(Websock *ws, int reason);
httpd_cgi_state cgiWebSocketRecv(HttpdConnData *connData, char *data, int len);
9 years ago
//int ICACHE_FLASH_ATTR cgiWebsockBroadcast(char *resource, char *data, int len, int flags);
9 years ago
#endif