Git Product home page Git Product logo

qwebsockets's Introduction

Introduction

QWebSockets is a pure Qt implementation of WebSockets - both client and server. 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.

Features

  • Text and binary sockets
  • Frame-based and message-based signals
  • Works through proxies
  • Strict Unicode checking

Restrictions

Non-characters (according Unicode Standard 6.2) are rejected by QWebSockets, even if the UTF-8 sequence is valid.

Rationale

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 (including U+FFFE and U+FFFF), are valid UTF-8, and hence are perfectly acceptable within WebSocket text messages.
According to the Unicode standard, they SHOULD NOT be used in information interchange, but a recent corrigendum clarifies that non-characters CAN be exchanged.
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.
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: �).

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.

Requirements

Qt 5.x

Compliance

QWebSockets is compliant with RFC6455 and has been tested with the Autobahn Testsuite.
Only tests with Unicode non-characters do not pass from the Autobahn Testsuite (see Restrictions).

Missing Features

  • WSS protocol
  • Extensions and sub-protocols

License

This code is licensed under LGPL v3.

qwebsockets's People

Contributors

kurtpattyn avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.