Skip to content

smasherprog/websocket_lite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

websocket_lite

Linux/Mac

Windows

This library is a fully compliant websocket implementation! Autobahn complete , but with a few design goals:

  • Cross-platform: Asio https://github.com/chriskohlhoff/asio/
  • Performance
  • Simple and easy to use
  • Latest standards: c++ 17
  • All functions are thread-safe and can be called from any thread at any time

Dependencies: Cmake, openssl, zlib

  • Ubuntu: sudo apt-get install libssl-dev zlib1g-dev -y
  • Mac: brew install openssl zlib
  • WIndows: vcpkg install openssl zlib

USAGE

To get started check out the example here

https://github.com/smasherprog/websocket_lite/blob/master/Test/main.cpp

SL::WS_LITE::PortNumber port(3002);
auto listener =
  SL::WS_LITE::CreateContext(SL::WS_LITE::ThreadCount(1))
    ->NoTLS()
    ->CreateListener(port)
    ->onConnection([&](const std::shared_ptr<SL::WS_LITE::IWSocket> &socket, const std::unordered_map<std::string, std::string> &header) {
 
    })
    ->onMessage([&](const std::shared_ptr<SL::WS_LITE::IWSocket> &socket, const SL::WS_LITE::WSMessage &message) {

    })->listen();
    listener->set_ReadTimeout(std::chrono::seconds(100));
    listener->set_WriteTimeout(std::chrono::seconds(100));
    
auto clientctx =
  SL::WS_LITE::CreateContext(SL::WS_LITE::ThreadCount(1))
    ->NoTLS()
    ->CreateClient()
    ->onConnection([&](const std::shared_ptr<SL::WS_LITE::IWSocket> &socket, const std::unordered_map<std::string, std::string> &header) {

    })
    ->onDisconnection([&](const std::shared_ptr<SL::WS_LITE::IWSocket> &socket, unsigned short code, const std::string &msg) {
    })->connect("localhost", port);
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy