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:
@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user