Comments (6)
Sorry for the late reply. Apparently the author of facil.io is working on a new version here which will support streaming w/o blocking a worker thread.
Once this is ready, I consider re-basing zap on top of the new version. This might take a while though, tbh.
from zap.
It seems the existing stable facil.io-0.7 contains an internal function
http_internal.h:
/** Should send existing headers and data and prepare for streaming */
int (*const http_stream)(http_s *h, void *data, uintptr_t length);
but it does not seem to be used anywhere throughout the code (tried grep *.h and *.c for http_stream
). Certainly it is not exposed to the end-user.
The other function below seems to be used in the code:
/** Should send existing headers or complete streaming */
void (*const http_finish)(http_s *h);
Perhaps it is time to check out the facil.io 0.8.X development branch but it does not seem to be actively developed right now.
from zap.
Thanks for the info. I thought facil.io had been pretty much "dead", that the new 0.8.X development was stalled. Apparently it is still alive.
from zap.
One more thing: You can consider websockets or even server-side messages as an alternative of streaming. Both are supported by facil.io, and at least web-sockets are wrapped by zap. SSM should be easy enough to wrap, too...
Just some thoughts 😄
from zap.
Yes it's a good thought. Though the WebSockets are already used for streaming real-time binary messages during a normal operation of the web site. The streaming HTTP is used during the initial phase of the web site loading in order to stream real-time compressed output from the gzip (stream compressed chemical molecules whilst the data is being retrieved from the server database), all done prior to opening a WebSocket connection.
There is quite a lot going on "in the background" upon opening a web site. Streaming left and right, establishing the main WebSocket connection - reserved for non-HTTP streaming - etc.
In addition, and this is the main reason for not using WebSockets in this case: the Server-Side Events or WebSocket responses cannot be cached. HTTP streams are treated like normal HTTP responses by caching proxies and web browsers. Therefore I take full advantage of HTTP response caching to avoid HTTP streaming of responses that have already been delivered to the browser before.
from zap.
Thanks but, Server-Side Events (SSE) and WebSocket messages do not support caching by browsers and proxies. HTTP responses are cached, and my application relies on caching. HTTP streams (chunked transfer encoding) are treated like normal HTTP responses and are properly cached.
SSE and WebSockets are not cached (nor should they be). Therefore there is a clear requirement for both HTTP streaming as well as WebSockets. A division of labour, so to speak.
from zap.
Related Issues (20)
- Build error HOT 2
- Deprecated LazyPath breaks with Zig master HOT 1
- Connect database HOT 1
- TLS + Multiple threads will crash the process randomly HOT 2
- Performance result looks wierd for c++ HOT 2
- Zig 0.13 build error HOT 7
- Framework not starting HOT 1
- Cannot build Zap HOT 1
- getHeader is not working HOT 15
- How to implement OpenAPI docs for the backend? HOT 2
- Middleware not respecting Endpoint's `path` setting HOT 3
- TODO: make Router more strict wrt types of handler functions
- Zap won't compile on Microsoft Windows. HOT 2
- Zig as a starter HOT 13
- Failure to compile facil.io : unable to build C object: clang exited with code 1 HOT 2
- RequestHandler doesn't work with multiple invocations where self is the same type HOT 3
- hot-code reloading or swapping HOT 1
- Segfault after 60 seconds of inactivity HOT 12
- Add examples/tests for getHeaderCommon
- Maximum number of concurrent requests per Zap process HOT 2
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 zap.