Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what are the Streaming APIs

Tags:

api

basically I want to understand both high level and also technical point of view as what constitutes a streaming API, there are all sorts of data available but I could not find a satisfactory explanation of streaming API, also how does it differ from general APIs (REST if applicable)

PS:I am not asking about multimedia streaming.

like image 253
Vaibhav Mishra Avatar asked Aug 06 '12 05:08

Vaibhav Mishra


2 Answers

Kind of a vague question. I guess streaming usually means one of the following (or a combination)

  • downloading data for immediate consumption, rather than a whole file for storage, potentially with support for delivering partial data (lower quality, only relevant pieces etc), sometimes even without any storage at all in between producer and consumer
  • a persistent connection that continues to deliver new data as it becomes available, rather than having the client poll

A good example (for the first pattern) are streaming XML parsers (such as SAX). They allow you to handle XML data that is too big to fit into memory (which a DOM parser likes to do).

like image 88
Thilo Avatar answered Oct 07 '22 00:10

Thilo


I just find another good answer here: https://www.quora.com/What-is-meant-by-streaming-API

A streaming API differs from the normal REST API in the way that it leaves the HTTP connection open for as long as possible(i.e. "persistent connection"). It pushes data to the client as and when it's available and there is no need for the client to poll the requests to the server for newer data. This approach of maintaining a persistent connection reduces the network latency significantly when a server produces continous stream of data like say, today's social media channels. These APIs are mostly used to read/subscribe to data.

like image 31
Xianwei Avatar answered Oct 07 '22 00:10

Xianwei