1
0
mirror of https://github.com/lammertb/libhttp.git synced 2025-07-29 21:01:13 +03:00

Update websocket example - store websocket clients per server context instead of using static variables

This commit is contained in:
bel
2014-08-11 00:22:07 +02:00
parent 265d2309a1
commit 624aed908d
3 changed files with 35 additions and 25 deletions

View File

@ -8,6 +8,19 @@
extern "C" {
#endif
typedef struct tWebSockInfo {
int webSockState;
unsigned long initId;
struct mg_connection *conn;
} tWebSockInfo;
#define MAX_NUM_OF_WEBSOCKS (256)
typedef struct tWebSockContext {
void * thread_id;
tWebSockInfo *socketList[MAX_NUM_OF_WEBSOCKS];
} tWebSockContext;
void websock_init_lib(struct mg_context *ctx);
void websock_exit_lib(struct mg_context *ctx);