3 ms·
Brilliant, thanks for this! I'll go check them out.
by kevindeasis 10y ago
Brilliant, thanks for this! I'll go check them out.
- niftich 10y agoI should expand my point by saying that all the XHR stuff and Server-Sent Events are simultaneously Javascript APIs exposed in the browser's script context, but also techniques/"protocols" that an HTTP client can implement by adhering to a specific behavior. For example, any HTTP client can receive server-sent events in the wire-level HTTP sense, like curl [1], which will just print all data being streamed to it until you abort; but it doesn't provide an API equivalent to the onMessage semantics like you get in the browser. To understand the distinction, see this github issue about adding "support" for Server-Side Events for another HTTP client here [2]. If your HTTP client library of choice doesn't provide the semantics you want, you may be able to build them in yourself. [1] http://stackoverflow.com/questions/31238626/ http://stackoverflow.com/questions/31238626/ [2] https://github.com/square/retrofit/issues/1029 https://github.com/square/retrofit/issues/1029