From db6e883c22945436f987af8d458124aea88b3bf3 Mon Sep 17 00:00:00 2001 From: Sergey Lyubka <valenok@gmail.com> Date: Tue, 13 May 2014 09:33:10 +0100 Subject: [PATCH] Added mg_wakeup_server_ex(), removed mg_wakeup_server() and mg_iterate_over_connections() --- docs/API.md | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/docs/API.md b/docs/API.md index 8696c466a..1eadcb764 100644 --- a/docs/API.md +++ b/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 is returned. - - void mg_iterate_over_connections(struct mg_server *, mg_handler_t func); - -This is an interface primarily designed to push arbitrary data to websocket -connections at any time. This function could be called from the Mongoose thread -only. When it returns, Mongoose thread calls `func()` for each active -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_wakeup_server_ex(struct mg_server *, mg_handler_t func, + const char *fmt, ...); + +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 function is designed to push data to the connected clients, and +can be called from any thread. There is a limitation on the length of +the message, currently at 8 kilobytes. void mg_send_status(struct mg_connection *, int status_code); void mg_send_header(struct mg_connection *, const char *name, -- GitLab