Giter Club home page Giter Club logo

ws28's Introduction

ws28

C++17 WebSocket server library

Do you use this in production?

Yes.

Should I use this in production?

Maybe.

Is it spec compliant?

Mostly. There's no UTF-8 validation. Everything else should be spec compliant.

How do I use this?

  1. Copy the source files into your project, I don't like making libraries.

  2. Create a server:

ws28::Server server{uv_default_loop(), SSL_CTX* or nullptr};

Note: if you have a secure server, it'll actually listen for both secure and insecure connections on that same port by sniffing the first byte. This allows you to run insecure websocket servers on port 443 and not deal with the swarm of broken proxies out there.

  1. Set up some callbacks

    See src/Server.h. But basically, you need some or all of these methods from ws28::Server: SetClientConnectedCallback, SetClientDisconnectedCallback, SetClientDataCallback, SetCheckConnectionCallback and SetHTTPCallback.

  2. Listen

server.Listen(port);

You can also check echo.cpp for an echo server implementation.

What's the license?

Most files are MIT. The base64 code is BSD, feel free to pull request some MIT licensed code to replace it.

More FAQ

Can I store pointers to ws28::Client?

Only between ClientConnected and ClientDisconnected callbacks for each client. It is deleted immediately after ClientDisconnected.

ws28's People

Contributors

matheus28 avatar bluecannonball avatar steve-dusty avatar

Stargazers

zhaoyao 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.