Changelog
2.0.3 (2024-04-18)
Ably.Realtime
instance in the Vercel Edge runtime #1736ErrorInfo
export to be accessed as a named export in ESM and when using commonjs interop #1741ReferenceError: self is not defined
error when running Jest tests in React Native using ably-js #1738httpMaxRetryDuration
client option didn't actually limit max elapsed time for rest fallback host retries #1721httpRequestTimeout
client option was wrongly 15 seconds instead of expected 10 seconds #1721Changelog
2.0.0 (2024-03-22)
The 2.0.0 release introduces a number of new features and QoL improvements, including a new way to remove bloat and reduce the bundle size of your ably-js client, first-class support for Promises, a more idiomatic approach to using ably-js' React Hooks, enhancements to TypeScript typings, and more.
Below is an overview of the major changes in this release.
Please refer to the ably-js v2 lib migration guide and React Hooks migration guide for the full details, including a list of all breaking changes and instructions on how to address them.
The default bundle size for the web has been reduced by ~32% compared to v1 - from 234.11 KiB to 159.32 KiB. When calculated with gzip compression, the reduction is ~30%, from 82.54 KiB to 57.9 KiB.
Additionally, by utilizing the new modular variant of the library (see below) and JavaScript tree shaking, you can create your own minimal useful Realtime
client and achieve a bundle size reduction of ~60.5% compared to v1 - from 234.11 KiB to 92.38 KiB (or ~66% for gzip: from 82.54 KiB to 28.18 KiB).
An ESM variant of the library is now available for browsers (but not for Node.js) via import from ably/modular
. This modular variant of the library supports tree shaking, allowing for a reduction in the Ably bundle size within your application and improving the user experience. It can also be used by Web Workers.
React Hooks, exported at ably/react
, now require the new ChannelProvider
component to define the channels you wish to use and the options for them. This addresses the complexities previously encountered with useChannel
and usePresence
hooks when attempting to dynamically change options for a channel and provides a more straightforward approach to set and manage these options.
The functionality of the usePresence
hook has been split into two separate hooks: usePresence
, which is now used only to enter presence, and usePresenceListener
, which is used to listen for presence updates. These new hooks offer better control over the desired presence behavior in your React components.
The callbacks API has been entirely removed, and the library now supports promises for all its asynchronous operations by default.
The Types namespace has been removed. All types it contained are now exported at the top level.
ably/build/ably.noencryption
bundle has been removed, as it is no longer necessary.ably/build/ably-webworker
bundle has been removed, as it is no longer necessary.ChannelProvider
component to React Hooks #1620, #1654generateRandomKey
#1320version
param to Rest.request
#1231id
field to be named ablyId
in React Hooks #1676usePresence
hook to two different hooks: for entering presence and subscribing to presence updates #1674ChannelModes
type #1601Message
-shaped object #1515Crypto.generateRandomKey
API to use Promises #1351fromEncoded()
and fromEncodedArray()
methods on Message
and PresenceMessage
to be async #1311XHRStreaming
transport support #1645recoveryKey
in favour of createRecoveryKey()
on Connection
#1613any
from stats()
param type #1561ably/build/ably-webworker
and add support for using ably
and ably/modular
in Web Workers #1550Types
namespace #1518noencryption
variant of the library #1500ably-commonjs*.js
files #1229fromEncoded*
type declarations #1222ClientOptions
parameters #1221ClientOptions.log
property and replace it with separate logLevel
and logHandler
properties #1216whenState
inconsistent behavior in Connection
and RealtimeChannel
#1640Crypto.getDefaultParams
#1352Changelog
1.2.50 (2024-03-21)
ClientOptions
and add a deprecation warning for the old one #1671ClientOptions.maxMessageSize
to the public API #1678headers
client option #1681PaginatedResource
#1631Crypto.getDefaultParams()
#1693