2016-05-12 04:36:12 +08:00
|
|
|
---
|
|
|
|
title: "mg_broadcast()"
|
|
|
|
decl_name: "mg_broadcast"
|
|
|
|
symbol_kind: "func"
|
|
|
|
signature: |
|
|
|
|
void mg_broadcast(struct mg_mgr *, mg_event_handler_t func, void *, size_t);
|
|
|
|
---
|
|
|
|
|
2016-07-22 20:37:46 +08:00
|
|
|
Pass a message of a given length to all connections.
|
2016-05-12 04:36:12 +08:00
|
|
|
|
|
|
|
Must be called from a thread that does NOT call `mg_mgr_poll()`.
|
|
|
|
Note that `mg_broadcast()` is the only function
|
|
|
|
that can be, and must be, called from a different (non-IO) thread.
|
|
|
|
|
|
|
|
`func` callback function will be called by the IO thread for each
|
2016-07-22 20:37:46 +08:00
|
|
|
connection. When called, event would be `MG_EV_POLL`, and message will
|
|
|
|
be passed as `ev_data` pointer. Maximum message size is capped
|
2016-05-12 04:36:12 +08:00
|
|
|
by `MG_CTL_MSG_MESSAGE_SIZE` which is set to 8192 bytes.
|
|
|
|
|