•October 28th 2015
Continue reading to find out about all new features introduced in this release.
All methods that perform an asynchronous request to the Stream API now return a promise. These promises help you avoid "callback hell" and chain API calls. If you've never heard about promises read this article on HTLM5 Rocks. Promises allow us to chain two asynchronous calls after eachother while only handling errors at the end of the promise chain, instead of nesting within callbacks.
Callbacks are still supported but the XHR Request object can no longer be manipulated since it is not returned.
The error object supplied to an error handler contains two properties: the response object created by the XHRRequest and an error object with additional information on the origin of the failure.
Two new API features for batch operations have been added to the client. First it is now possible to add one activity to multiple feeds through a single API call, with the method addToMany on the client object. The second batch operation allows you to create multiple follow relations through the use of followMany.
To create multiple follow relations within a single api call, use the followMany function of client.
If you want to create a follow relation without copying the history of the target feed, this is now possible through the use of 'activity_copy_limit' API feature.
When connecting to stream through .connect you can supply additional arguments in the fourth parameter. It is now possible to enable expiration of tokens generated by the stream client. The default behaviour is to never expire the generated tokens.