mirror of
https://github.com/cesanta/mongoose.git
synced 2025-01-01 11:07:46 +08:00
Added mg_wakeup_server_ex(), removed mg_wakeup_server() and mg_iterate_over_connections()
This commit is contained in:
parent
804da054b5
commit
db6e883c22
23
docs/API.md
23
docs/API.md
@ -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,
|
||||||
|
const char *fmt, ...);
|
||||||
|
|
||||||
void mg_iterate_over_connections(struct mg_server *, mg_handler_t func);
|
Sends string message to a server. Function `func` is called for every active
|
||||||
|
connection. String message is passed in `struct mg_connection::callback_param`.
|
||||||
This is an interface primarily designed to push arbitrary data to websocket
|
This function is designed to push data to the connected clients, and
|
||||||
connections at any time. This function could be called from the Mongoose thread
|
can be called from any thread. There is a limitation on the length of
|
||||||
only. When it returns, Mongoose thread calls `func()` for each active
|
the message, currently at 8 kilobytes.
|
||||||
connection.
|
|
||||||
It is allowed to call `mg_send_data()` or `mg_websocket_write()` within a
|
|
||||||
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,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user