Javascript, Node, Typescript, React, React Native client library SDK for Ably realtime messaging service
APACHE-2.0 License
With this release, Ably React Hooks have now moved to the general availability phase and are considered stable. Non-major version changes to the ably
package won't include breaking changes for React Hooks going forward.
All changes:
ClientOptions.recoveryKeyStorageName
#1762
*
and privileged-headers
values for TokenParams.capability
field #1765
logHandler
per Ably client by removing the global effects of setting logHandler
and logLevel
#1764
updateStatus
function returned by usePresence
hook to be async #1777
ConnectionManager
have misleading stack traces #1760
FetchRequest
doesn't properly handle a 204 response #1773
Connection closed
errors when using usePresence
hook #1761
Unable to enter presence channel while in suspended state
errors with usePresence
#1781
Can't resolve 'ably'
error for environments that don't support exports
field in package.json
yet #1782
Published by VeskeR 6 months ago
Ably.Realtime
instance in the Vercel Edge runtime #1736
ErrorInfo
export to be accessed as a named export in ESM and when using commonjs interop #1741
ReferenceError: self is not defined
error when running Jest tests in React Native using ably-js #1738
httpMaxRetryDuration
client option didn't actually limit max elapsed time for rest fallback host retries #1721
httpRequestTimeout
client option was wrongly 15 seconds instead of expected 10 seconds #1721
Published by VeskeR 7 months ago
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, #1654
generateRandomKey
#1320
version
param to Rest.request
#1231
id
field to be named ablyId
in React Hooks #1676
usePresence
hook to two different hooks: for entering presence and subscribing to presence updates #1674
ChannelModes
type #1601
Message
-shaped object #1515
Crypto.generateRandomKey
API to use Promises #1351
fromEncoded()
and fromEncodedArray()
methods on Message
and PresenceMessage
to be async #1311
XHRStreaming
transport support #1645
recoveryKey
in favour of createRecoveryKey()
on Connection
#1613
any
from stats()
param type #1561
ably/build/ably-webworker
and add support for using ably
and ably/modular
in Web Workers #1550
Types
namespace #1518
noencryption
variant of the library #1500
ably-commonjs*.js
files #1229
fromEncoded*
type declarations #1222
ClientOptions
parameters #1221
ClientOptions.log
property and replace it with separate logLevel
and logHandler
properties #1216
whenState
inconsistent behavior in Connection
and RealtimeChannel
#1640
Crypto.getDefaultParams
#1352
Published by VeskeR 7 months ago
ClientOptions
and add a deprecation warning for the old one #1671
ClientOptions.maxMessageSize
to the public API #1678
headers
client option #1681
PaginatedResource
#1631
Crypto.getDefaultParams()
#1693
Published by owenpearson almost 1 year ago
Published by owenpearson over 1 year ago
This release adds a new experimental channels.getDerived
method which allows you to create custom realtime data feeds by selectively subscribing to receive only part of the data from the channel. See the announcement post for more information.
Message.connectionId
optional #1305
ProtocolMessage.connectionKey
#1218
Presence.history
signature #1224
ArrayBuffer
plaintext #1280
Published by owenpearson over 1 year ago