|
1 /** |
|
2 * @file websocket.h |
|
3 */ |
|
4 |
|
5 #ifndef _WEBSOCKET_H |
|
6 #define _WEBSOCKET_H |
|
7 |
|
8 |
|
9 struct per_session_data__lws_mirror { |
|
10 struct lws *wsi; |
|
11 int ringbuffer_tail; |
|
12 }; |
|
13 |
|
14 /** |
|
15 * @brief Broadcast messages to all connected websocket clients. |
|
16 * @param msg The message to send. Messages are placed in a ringbuffer queue. |
|
17 */ |
|
18 void ws_broadcast(char *msg); |
|
19 |
|
20 /** |
|
21 * @brief Check if a connection is idle for 45 seconds and if so send a ping like |
|
22 * message to keep the connection alive. Call this function at regular intervals. |
|
23 */ |
|
24 void ws_check(void); |
|
25 |
|
26 /** |
|
27 * @brief The websockets server thread. |
|
28 */ |
|
29 void *ws_loop(void *); |
|
30 |
|
31 #endif |