Commit db6e883c authored by Sergey Lyubka's avatar Sergey Lyubka

Added mg_wakeup_server_ex(), removed mg_wakeup_server() and mg_iterate_over_connections()

parent 804da054
...@@ -136,23 +136,14 @@ given parameter name is not valid, NULL is returned. For valid names, return ...@@ -136,23 +136,14 @@ given parameter name is not valid, NULL is returned. For valid names, return
value is guaranteed to be non-NULL. If parameter is not set, zero-length string value is guaranteed to be non-NULL. If parameter is not set, zero-length string
is returned. is returned.
void mg_wakeup_server_ex(struct mg_server *, mg_handler_t func,
void mg_iterate_over_connections(struct mg_server *, mg_handler_t func); const char *fmt, ...);
This is an interface primarily designed to push arbitrary data to websocket Sends string message to a server. Function `func` is called for every active
connections at any time. This function could be called from the Mongoose thread connection. String message is passed in `struct mg_connection::callback_param`.
only. When it returns, Mongoose thread calls `func()` for each active This function is designed to push data to the connected clients, and
connection. can be called from any thread. There is a limitation on the length of
It is allowed to call `mg_send_data()` or `mg_websocket_write()` within a the message, currently at 8 kilobytes.
callback, cause `func` is executed in the context of the Mongoose thread.
void mg_wakeup_server(struct mg_server *);
Makes `mg_poll_server()` that could be sleeping in the `select()` syscall
to break the call and return. This function can be called from any thread.
It is designed to let other threads wake up Mongoose thread from the sleep
and let it do a fresh new IO iteration over all connection. Usually it is done
when other threads decides there is new data ready to be sent by Mongoose.
void mg_send_status(struct mg_connection *, int status_code); void mg_send_status(struct mg_connection *, int status_code);
void mg_send_header(struct mg_connection *, const char *name, void mg_send_header(struct mg_connection *, const char *name,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment