Giter Site home page Giter Site logo

Comments (1)

mattgodbolt avatar mattgodbolt commented on June 6, 2024

is it possible to stream JSON data regardless of if a client is connected to the endpoint, and once the client connects, it starts doing something with the data the server is streaming ?

With no clients, there's nothing to stream to. You can write code to buffer those JSON documents though.

can you add multiple / routes, and run them on separate threads ? My goal is to add a / route for each ZMQ socket receiving data, to later stream them on different tabs on the React app.

Not easily. Seasocks is inherently single-threaded, but typically if you have work on other threads you can kick them to the seasocks thread to send.

In similar designs I've used before I end up having a buffer of messages, and then onConnect I send them all to new clients. On a new message I add to the buffer (for later replay), and then loop over all currently connected instances to send to them.

If those messages are generated on another thread I'll use seasocks.execute() to ensure the enqueing/loop over all instances happens on the Seasocks thread, while everything else happens on my other threads.

If I get time I'll try and write an example that does this kind of thing - it's the kind of Seasocks is designed for. (originally, outputting streaming market data from a C++ trading app for visualisation)

from seasocks.

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.