Code Monkey home page Code Monkey logo

Comments (3)

ChristophConrads-deepstreamHub avatar ChristophConrads-deepstreamHub commented on August 9, 2024

README: add a list of C, C++ WebSocket libraries

from deepstream.io-client-cpp.

ChristophConrads-deepstreamHub avatar ChristophConrads-deepstreamHub commented on August 9, 2024

Initially, I decided to use WebSocket++ because

  • header-only,
  • BSD or Boost license,
  • single purpose, and
  • many stars and forks on GitHub.
    WebSocket++ immediately revealed a few code smells:
  • holey documentation,
  • manual initialization in a language with constructors ([example)[https://github.com/zaphoyd/websocketpp/blob/378437aecdcb1dfe62096ffd5d944bf1f640ccc3/examples/scratch_client/scratch_client.cpp#L119-L120]),
  • implementation-dependent initialization although templates are used (see previous example).

With POCO C++ libraries, setting up a client takes four (or six short) lines of code.

from deepstream.io-client-cpp.

yasserf avatar yasserf commented on August 9, 2024

Can you also mention the interface you are going for when integrating the websocket library?

Since all websocket libraries use the

open
close
error
message

callbacks I would recommend something along the lines of ( in total pseduo code):

create( String: url to connect to )
open()
close()
send(String: as a string message)

onOpen(handler) -> handler call doesn't need arguments
onClose(handler) -> handler call doesn't need arguments
onError(handler) -> error message argument
onMessage(handler) -> Single string message argument

Integration wise, I would inject it into the connection class when the client is first created. This will give the connection class full control, and passing the connection class around is better than the entire client since it has a subset of functionality and stops unrequired methods being potentially exposed on the client object.

from deepstream.io-client-cpp.

Related Issues (20)

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.