Comments (1)
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)
- Make Maximum Message Size Configurable HOT 1
- Own Error page support HOT 3
- Support for OPTIONS request for CORS reasons HOT 11
- Conform to conan licensing practices HOT 2
- Why does this API so strictly enforce thread management? HOT 1
- PathHandler for /:id style API
- Title in readme HOT 2
- It's easy to get files outside of the static dir HOT 1
- Clarify use case and security disclosure etc
- unxi domain socket support for websocket
- Conan center build 1.4.5 failed HOT 12
- Clang 15 CI build uses ARM instead of x86_64 HOT 1
- Use Seasocks with makefile HOT 9
- Static link seasocks HOT 1
- Test migration to Catch 3.x
- Deleted HOT 2
- sending large HTTP responses doesn't work
- UTF-8 support
- type overflow _bytesSent
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from seasocks.