File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11WebSocket frame parser
22======================
33
4-
54### Features
65* No dependencies
76* No internal buffering
87* No need to buffer the whole frame — works with chunks of a data
8+ * No syscalls
9+ * No allocations
10+ * It can be interrupted at anytime
911
10- This is a parser for WebSocket frame-messages written in C (by [ RFC6455] ( https://tools.ietf.org/html/rfc6455 ) ).
11- It does not make any syscalls nor allocations, it does not
12- buffer data, it can be interrupted at anytime.
12+ This is a parser for WebSocket frame-messages written in C (see [ RFC6455] ( https://tools.ietf.org/html/rfc6455 ) ).
1313
1414Tested as part of [ PHP-ION] ( https://github.com/php-ion/php-ion ) extension.
1515
@@ -81,11 +81,13 @@ When data is received execute the parser and check for errors.
8181
8282```c
8383size_t nread;
84+ // .. init settitngs and parser ...
8485
8586nread = websocket_parser_execute(parser, &settings, data, data_len);
86- if(parser->error || nread != data_len) {
87- // e.g. log error
87+ if(nread != data_len) {
88+ // some callback return a value other than 0
8889}
90+
8991// ...
9092free(parser);
9193```
You can’t perform that action at this time.
0 commit comments