| 1 | ### Introduction |
| 2 | QWebSockets is a pure Qt implementation of WebSockets - both client and server. |
| 3 | It is implemented as a Qt source code module (.pri file), that can easily be embedded into existing Qt projects. It has no other dependencies that Qt. |
| 4 | |
| 5 | ### Features |
| 6 | * Text and binary sockets |
| 7 | * Frame-based and message-based signals |
| 8 | * Works through proxies |
| 9 | * Strict Unicode checking |
| 10 | |
| 11 | ### Restrictions |
| 12 | Non-characters (according [Unicode Standard 6.2](http://www.unicode.org/versions/Unicode6.2.0/)) are rejected by QWebSockets, **even if the UTF-8 sequence is valid**. |
| 13 | ##### Rationale |
| 14 | The WebSocket specification is talking about _Valid UTF-8 codes and sequences_. Strictly speaking, UTF-xx encodings are reversible. That means, that the [66 non-character codes](http://www.unicode.org/faq/private_use.html#noncharacters) (including `U+FFFE` and `U+FFFF`), are valid UTF-8, and hence are perfectly acceptable within WebSocket text messages. |
| 15 | According to the Unicode standard, they SHOULD NOT be used in information interchange, but a [recent corrigendum](http://www.unicode.org/versions/corrigendum9.html) clarifies that non-characters CAN be exchanged. |
| 16 | However, non-characters are for internal use, and hence, they are implementation specific (e.g. non-characters can be used to carry meta-information). _They have to be interpreted._ |
| 17 | When used with `QString`, they are replaced with `U+FFFD - REPLACEMENT CHARACTER`, and rendered - non-standard - as a question mark (this is the `QString` rendering of the non-character `U+FFFD`: �). Browsers keep the control characters untouched (this is the browser rendering of the non-character `U+FDD0`: ). |
| 18 | |
| 19 | With QWebSockets, text messages are just that: a collection of human-readable characters. Text messages never have to be interpreted to be rendered correctly. In case, you still want to do implementation specific trickery, use binary messages instead. Indeed, if non-characters were allowed in text messages, then every text message has to be parsed, character-per-character, to find out if it contains special control codes, or a protocol should be devised that indicates whether the message contains that kind of control codes. We keep it simple: text is text and nothing more. |
| 20 | |
| 21 | ### Requirements |
| 22 | Qt 5.x |
| 23 | |
| 24 | ### Usage |
| 25 | Include the .pri file into your Qt project |
| 26 | ~~~ |
| 27 | include (websocket.pri) |
| 28 | ~~~ |
| 29 | |
| 30 | ### Compliance |
| 31 | QWebSockets is compliant with [RFC6455](http://datatracker.ietf.org/doc/rfc6455/?include_text=1) and has been tested with the [Autobahn Testsuite](http://autobahn.ws/testsuite). |
| 32 | Only tests with **Unicode non-characters** do **not** pass from the Autobahn Testsuite (see [Restrictions](#Restrictions)). |
| 33 | |
| 34 | ### Missing Features |
| 35 | * WSS protocol |
| 36 | * Extensions and sub-protocols |
| 37 | |
| 38 | ### License |
| 39 | This code is licensed under LGPL v3. |