Skip to content

SocketCluster.io client for C++11 or higher using Boost Beast

License

Notifications You must be signed in to change notification settings

cw-zift/scio-beast

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

scio-beast

SocketCluster.io C++ client utilizing Boost.Beast and modern JSON.

Status

Early work in progress!

Needing Attention

  • Simplify wss:// vs ws:// code
  • SCChannel.publish()
  • General code cleanup

Dependencies

  • C++11 or higher
  • Boost.Beast (header only)
  • JSON (header only)
  • OpenSSL to link against

Usage

// create options
scio_beast::SocketClusterClientOptions clientOpts;

clientOpts.connectOptions
  .setHost("localhost")
  .setPort("8000")
  ;

// create a client
auto client = scio_beast::SocketClusterClient::create(clientOpts);

// create a client socket
auto socket = client->socket();

socket->on<scio::beast::SCSocket::ConnectEvent>(
  [](const json& resp) {
    std::cout << "Connected!" << std::endl;
  }
);

// connect
socket->connect();

Codecs

Codecs can be created by implementing the scio_beast::ICodecEngine interface. A scio_beast::CodecEngineMinBin that works with sc-codec-min-bin is included. For example:

std::shared_ptr<scio_beast::ICodecEngine> codecEngine(new scio_beast::CodecEngineMinBin());
// ...
connectOptions.setCodecEngine(codecEngine);

License

See LICENSE

Releases

No releases published

Packages

No packages published

Languages