Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
3550cc8f
Commit
3550cc8f
authored
Jul 22, 2016
by
Evelyn
Committed by
GitHub
Jul 22, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update mg_set_protocol_http_websocket.md
parent
6a3d01ee
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
21 deletions
+20
-21
mg_set_protocol_http_websocket.md
docs/c-api/http.h/mg_set_protocol_http_websocket.md
+20
-21
No files found.
docs/c-api/http.h/mg_set_protocol_http_websocket.md
View file @
3550cc8f
...
...
@@ -6,43 +6,42 @@ signature: |
void mg_set_protocol_http_websocket(struct mg_connection *nc);
---
Attach
built-in HTTP event handler to the
given connection.
User-defined event handler will receiv
e following extra events:
Attach
a built-in HTTP event handler to a
given connection.
The user-defined event handler will receive th
e following extra events:
-
MG_EV_HTTP_REQUEST: HTTP request has arrived. Parsed HTTP request
is passed as
`struct http_message`
through the handler's
`void *ev_data`
pointer.
-
MG_EV_HTTP_MULTIPART_REQUEST: A multipart POST request has received.
This event is sent before
body is parsed. After this
user
-
MG_EV_HTTP_MULTIPART_REQUEST: A multipart POST request has
been
received.
This event is sent before
the body is parsed. After this the
user
should expect a sequence of MG_EV_HTTP_PART_BEGIN/DATA/END requests.
This is also the last time when headers and other request fields are
accessible.
-
MG_EV_HTTP_REPLY: HTTP reply has arrived.
P
arsed HTTP reply is passed as
-
MG_EV_HTTP_REPLY: HTTP reply has arrived.
The p
arsed HTTP reply is passed as
`struct http_message`
through the handler's
`void *ev_data`
pointer.
-
MG_EV_HTTP_CHUNK: HTTP chunked-encoding chunk has arrived.
P
arsed HTTP reply is passed as
`struct http_message`
through the
The p
arsed HTTP reply is passed as
`struct http_message`
through the
handler's
`void *ev_data`
pointer.
`http_message::body`
would contain
incomplete, reassembled HTTP body.
It will grow with every new chunk arrived
, and
potentially c
an c
onsume a lot of memory. An event handler may process
the body as chunks are coming, and signal Mongoose to delete processed
It will grow with every new chunk arrived
and could
potentially consume a lot of memory. An event handler may process
the body as chunks are coming
in
, and signal Mongoose to delete processed
body by setting
`MG_F_DELETE_CHUNK`
in
`mg_connection::flags`
. When
the last zero chunk is received,
Mongoose sends
`MG_EV_HTTP_REPLY`
event with
full reassembled body (if handler did not signal to delete chunks) or
with empty body (if handler did signal to delete chunks).
-
MG_EV_WEBSOCKET_HANDSHAKE_REQUEST: server has received
webs
ocket handshake
Mongoose sends
an
`MG_EV_HTTP_REPLY`
event with
the
full reassembled body (if handler did not signal to delete chunks) or
with
the
empty body (if handler did signal to delete chunks).
-
MG_EV_WEBSOCKET_HANDSHAKE_REQUEST: server has received
WebS
ocket handshake
request.
`ev_data`
contains parsed HTTP request.
-
MG_EV_WEBSOCKET_HANDSHAKE_DONE: server has completed Web
s
ocket handshake.
-
MG_EV_WEBSOCKET_HANDSHAKE_DONE: server has completed Web
S
ocket handshake.
`ev_data`
is
`NULL`
.
-
MG_EV_WEBSOCKET_FRAME: new
webs
ocket frame has arrived.
`ev_data`
is
-
MG_EV_WEBSOCKET_FRAME: new
WebS
ocket frame has arrived.
`ev_data`
is
`struct websocket_message *`
-
MG_EV_HTTP_PART_BEGIN: new part of multipart message is started,
extra parameters are passed in mg_http_multipart_part
-
MG_EV_HTTP_PART_DATA: new portion of data from multiparted message
no additional headers are available, only data and data size
-
MG_EV_HTTP_PART_END: final boundary received, analogue to maybe used to
find the end of packet
-
MG_EV_HTTP_PART_BEGIN: new part of multipart message is started.
Extra parameters are passed in mg_http_multipart_part
-
MG_EV_HTTP_PART_DATA: new portion of data from multiparted message has arrived.
No additional headers are available, only data and data size.
-
MG_EV_HTTP_PART_END: final boundary received. Marks the end of the multipart message.
Note: Mongoose should be compiled with MG_ENABLE_HTTP_STREAMING_MULTIPART
to enable MG_EV_HTTP_MULTIPART_REQUEST, MG_EV_HTTP_REQUEST_END,
MG_EV_HTTP_REQUEST_CANCEL, MG_EV_HTTP_PART_BEGIN, MG_EV_HTTP_PART_DATA,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment