Server-sent events explicitly requires --stream
See original GitHub issueIf I have a server-sent event source and try to simply do
http get http://localhost:1729/stream/all
I get output that looks something like this:
HTTP/1.1 200 OK
Cache-Control: no-cache
Content-Type: text/event-stream
Date: Sat, 29 Aug 2015 12:18:00 GMT
Server: TornadoServer/4.2.1
Transfer-Encoding: chunked
followed by none of the streamed data. This can be worked around by setting the --stream
flag. However, better behavior would be to automatically enable streaming support when Content-Type
is text/event-stream
.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:12
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Harness the power of Server-Sent Events (SSE) in Node.js ...
1. Create a uni-directional connection (server to client) using the '/events' route that creates an event stream connection with the client.
Read more >Server-sent events: a simple way to stream events from a server
Here's how server-sent events work. I was SO DELIGHTED to learn that they're just HTTP requests. ... The wire protocol is really simple...
Read more >A Look at Server Sent Events | simonprickett.dev
Server Sent Events are a standard allowing browser clients to receive a stream of updates from a server over a HTTP connection without...
Read more >What Server-Sent Events is - and how and when to implement it
The idea is simple: a browser can subscribe to a stream of events generated by a server, receiving updates whenever a new event...
Read more >Browser APIs and Protocols: Server-Sent Events (SSE)
To get started, we simply need to specify the URL of the SSE event stream resource and register the ... Subscribe to all...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, I’m a newbie to open source projects. I would like to contribute to make HTTPie to automatically recognize server sent events. Could you please provide me with more info and can I work on this issue?
Actually, the best behaviour is to auto-enable
--stream
when you seeTransfer-Encoding: chunked
because the length is indeterminate. That said, this is going to be near impossible to do for httpie. An example of what httpie is doing under the covers isWhat it does with
--stream
is:This means that by the time httpie has received the headers it’s too late to begin streaming. httpie would need to perform a
HEAD
request for every URL to determine whether or not to automatically enable--stream
for the user which would be wildly inefficient. While this is certainly a desirable feature, I’m not sure it’s practical.The one way to acommodate this would be for httpie to always pass
stream=True
to requests and if--stream
isn’t provided and the headers aren’t something that should require streaming, then it reads the whole content into memory (accessing thecontent
attribute will take care of that). Otherwise, it streams appropriately.I’m not sure if @jkbrzt wants httpie to absorb some logic from it’s dependencies though just to perform some magic.