Giter Club home page Giter Club logo

Comments (2)

domsson avatar domsson commented on July 19, 2024

I'm not sure this will be applicable here, but when I worked on my Twitch IRC library, I introduced a tick() function which would take care of all the necessary work the library would do during one iteration of the main loop. The user could then write their own main loop (which could include other, arbitrary code) and simply call tick() within that loop. See the wiki on that project in case you want to see if you could potentially draw inspiration from it.

from wsserver.

Theldus avatar Theldus commented on July 19, 2024

Hello @domsson,
I don't know if an 'all-in-one' function is ideal for this case... I wanted to leave some things apart like: listening, accepting a connection, receiving frames, and leave the user to invoke them individually.

But you raised an interesting point: the approach I described in the issue was designed to use blocking routines: wait for a connection, wait for frames, and so on. In fact, the entire wsServer was designed this way.

Your approach on the other hand suggests non-blocking routines (and in fact for that you use epoll in your project). It would be interesting if these routines that I suggested could be non-blocking too so that the user could use them either with threads, select, poll, epoll, libevent, etc.

But maybe this requires even major changes in the source code since my routines couldn't block in the midst of a received frame for example, as they do at the moment.

from wsserver.

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.