Engineers here at Twitter are always looking for ways to increase efficiency and simplify our codebase. To that end, we're deprecating HTTP 1.0 support for all streaming API endpoints. While our streaming API continues to grow, this version of the protocol is rarely used. Also, its successor (HTTP 1.1, introduced in 1999) offers features that are useful for streamed responses.
One of the biggest advantages HTTP 1.1 offers over 1.0 with regard to streamed data is its introduction of the Transfer-Encoding: chunked header. Use of chunked transfer encoding allows applications to more effectively manage read buffers, as chunk sizes are interleaved with data as Tweets are written to the stream.
Currently about 2 - 3% of streaming requests are HTTP 1.0. Despite the low volume, these requests are spaced out across a large number of user agents, so there's a long tail of clients using 1.0. We're reaching out to a few of the biggest sources of requests, but you should make sure that your streaming code is compatible with this change:
- If you rely on a third party library to interact with Twitter's streaming endpoints, make sure that it supports HTTP 1.1.
- If you wrote your own streaming API code or maintain a library, make sure your HTTP library supports 1.1 and that you are issuing HTTP 1.1 requests. Popular libraries such as libcurl typically have no problem parsing these responses.
- If you are serializing and deserializing your own HTTP requests, there will be a bit more work. Make sure you connect with a HTTP/1.1 request line, and make sure you can parse chunked transfer encoded streams.
To identify a HTTP 1.0 response, look for the version in the response header line, as well as a Connection: close response header:
HTTP/1.0 200 OK Content-Type: application/json Connection: close
An HTTP 1.1 response will contain a Transfer-Encoding: chunked header:
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked
We will continue to evaluate the impact of this change before setting a date for when to remove HTTP 1.0 support, and we’ll share that date as soon as we know it. Please note that if you are a consumer of the REST API, you will be unaffected by this change. Also note that despite the version numbers being identical, this change is unrelated to Twitter's API v1 retirement.
Please use this discussion thread to report any questions or feedback.