mirror of
https://github.com/cesanta/mongoose.git
synced 2024-11-24 19:19:00 +08:00
Merge pull request #1639 from cesanta/docs
Add mg_ws_printf()/vprintf() doc
This commit is contained in:
commit
3f21be4fb0
@ -1498,6 +1498,32 @@ void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
||||
}
|
||||
```
|
||||
|
||||
### mg\_ws\_printf(), mg\_ws\_vprintf()
|
||||
|
||||
```c
|
||||
size_t mg_ws_printf(struct mg_connection *, int op, const char *fmt, ...);
|
||||
size_t mg_ws_vprintf(struct mg_connection *, int op, const char *fmt, va_list);
|
||||
```
|
||||
|
||||
Same as `mg_ws_send()`, but formats data using `printf()` semantics.
|
||||
<span class="badge bg-danger">NOTE: </span> See [mg\_ws\_send](#mg_ws_send)
|
||||
for the list of possible Websocket message types
|
||||
<span class="badge bg-danger">NOTE: </span> See [mg\_snprintf](#mg_snprintf-mg_vsnprintf)
|
||||
for the list of supported format specifiers
|
||||
|
||||
Parameters:
|
||||
- `c` - Connection to use
|
||||
- `op` - Websocket message type
|
||||
- `fmt` - format string in `printf` semantics
|
||||
|
||||
Return value: sent bytes count
|
||||
|
||||
Usage example:
|
||||
|
||||
```c
|
||||
mg_ws_printf(c, WEBSOCKET_OP_TEXT, "Hello, %s!", "world");
|
||||
```
|
||||
|
||||
### mg\_ws\_wrap()
|
||||
|
||||
```c
|
||||
|
Loading…
Reference in New Issue
Block a user