Files
c-websocket-server/git/wsserver/doc/man/man3/ws_sendframe.3
2023-03-29 14:02:05 +02:00

67 lines
1.9 KiB
Groff

.\"
.\" Copyright (C) 2016-2022 Davidson Francis <davidsondfgl@gmail.com>
.\"
.\" This program is free software: you can redistribute it and/or modify
.\" it under the terms of the GNU General Public License as published by
.\" the Free Software Foundation, either version 3 of the License, or
.\" (at your option) any later version.
.\"
.\" This program is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with this program. If not, see <http://www.gnu.org/licenses/>
.\"
.TH man 3 "04 Apr 2022" "1.0" "wsServer man page"
.SH NAME
ws_sendframe \- Creates and send a masked WebSocket frame with some payload data.
.SH SYNOPSIS
.nf
.B #include <ws.h>
.sp
.BI "int ws_sendframe(ws_cli_conn_t " *client ", const char " *msg ", ssize_t " size ", int " type ");
.fi
.SH DESCRIPTION
.BR ws_sendframe ()
sends a given message
.I msg
to the client
.I client
with the size
.I size
for a given frame
.I type.
This routine is intended to be used to create a websocket frame for
a given type and sending to the client. For higher level routines,
please check
.I ws_sendframe_txt
and
.I ws_sendframe_bin.
.SH RETURN VALUE
Returns the number of bytes written.
.SH NOTES
.PP
The parameter
.I size
can be any value or -1, if the later, the size will be automatically calculated
from the message. Please note that null terminated strings are expected.
.PP
The acceptable values for
.I type
are:
.BR WS_FR_OP_TXT,
.BR WS_FR_OP_BIN
and
.BR WS_FR_OP_PONG.
.PP
If the parameter
.I client
is NULL, a broadcast message will be sent instead.
.SH SEE ALSO
.BR ws_sendframe_txt (3),
.BR ws_sendframe_bin (3)
.SH AUTHOR
Davidson Francis (davidsondfgl@gmail.com)