.\" Man page generated from reStructuredText. . .TH "WSLAY_EVENT_RECV" "3" "Sep 28, 2017" "@PACKAGE_VERSION@" "wslay" .SH NAME wslay_event_recv \- Receive messages . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B int wslay_event_recv(wslay_event_context_ptr\fI\ ctx\fP) .UNINDENT .SH DESCRIPTION .sp \fI\%wslay_event_recv()\fP receives messages from peer. When receiving messages, it uses \fBwslay_event_recv_callback\fP function. Single call of this function receives multiple messages until \fBwslay_event_recv_callback\fP function sets error code \fBWSLAY_ERR_WOULDBLOCK\fP\&. .sp \fI\%wslay_event_recv()\fP calls following callback functions for their own event (See \fBwslay_event_context_server_init()\fP or \fBwslay_event_context_client_init()\fP for the details of each callbacks). .INDENT 0.0 .TP .B \fBwslay_event_on_frame_recv_start_callback\fP Called when a new frame starts to be received. .TP .B \fBwslay_event_on_frame_recv_start_callback\fP Called when a new frame starts to be received. .TP .B \fBwslay_event_on_frame_recv_chunk_callback\fP Called when a chunk of frame payload is received. .TP .B \fBwslay_event_on_frame_recv_end_callback\fP Called when a frame is completely received. .TP .B \fBwslay_event_on_msg_recv_callback\fP Called when a message is completely received. .UNINDENT .sp When close control frame is received, this function automatically queues close control frame. Also this function calls \fBwslay_event_set_read_enabled()\fP with second argument 0 to disable further read from peer. .sp When ping control frame is received, this function automatically queues pong control frame. .sp In case of a fatal error which leads to negative return code, this function calls \fBwslay_event_set_read_enabled()\fP with second argument 0 to disable further read from peer. .SH RETURN VALUE .sp \fI\%wslay_event_recv()\fP returns 0 if it succeeds, or one of the following negative error codes: .INDENT 0.0 .TP \fBWSLAY_ERR_CALLBACK_FAILURE\fP User defined callback function is failed. .TP \fBWSLAY_ERR_NOMEM\fP Out of memory. .UNINDENT .sp When negative error code is returned, application must not make any further call of \fI\%wslay_event_recv()\fP and must close WebSocket connection. .SH SEE ALSO .sp \fBwslay_event_set_read_enabled()\fP .SH AUTHOR Tatsuhiro Tsujikawa .SH COPYRIGHT 2017, 2015, Tatsuhiro Tsujikawa .\" Generated by docutils manpage writer. .