Repository navigation
v3.0.0
The 3.0.0 release makes it clear what to use on a device and what to use on a server. The SDK is now split by where your code runs. Install @ably/pubsub-device for code that runs on an end user's device, such as a browser or a mobile app, or @ably/pubsub-server for code that runs on your own infrastructure. Each package offers only the clients and APIs that make sense on its side. The package names are also what coding assistants see in the install step and the import line, so they get the choice right too.
Device bundles are also smaller. MessagePack is now an opt-in plugin and most debug logging is stripped, so a web app that bundles @ably/pubsub-device from npm ships about 15% less minified code than with v2.30.0, or about 12% less gzipped. The CDN bundle shrinks by about the same.
v3 also removes the APIs and client options deprecated in v2.
Below is an overview of the major changes in this release.
Please refer to the ably-js v3 lib migration guide for the full details, including a list of all breaking changes and instructions on how to address them.
Per-side packages
This repository no longer publishes ably. Install the package for the side of the connection your code runs on:
@ably/pubsub-devicefor code that runs on an end user's device: a browser, React Native, Electron, or a mobile or desktop app. It offers a single realtime client,PubSubClient, which includes the device-side push APIs.@ably/pubsub-serverfor code that runs on infrastructure you operate: a Node.js server, a container, or a serverless function. It offers both a realtime client,PubSubRealtimeClient, and an HTTP client,PubSubHttpClient.
Clients are created through factory methods instead of constructors: createClient from @ably/pubsub-device, and createRealtimeClient and createHttpClient from @ably/pubsub-server.
Client API naming
RealtimeClientis renamedPubSubClienton a device andPubSubRealtimeClienton a server.RestClientis renamedPubSubHttpClient.Restis renamedHttpacross the public API, the modular plugins and the LiveObjects types, including the HTTP client'sHttpChannelandHttpPresence.- The
Message,PresenceMessage,AnnotationandCryptostatics are named class exports. - The
Ably-prefixed React Hooks exports are named after the Pub/Sub client, for exampleAblyProvideris nowPubSubClientProvideranduseAblyis nowusePubSubClient. They are exported from@ably/pubsub-device/reactand take aPubSubClient.
Push notifications
getDevice(),push.activate(),push.deactivate(),push.updateToken()andchannel.pushexist only on the@ably/pubsub-deviceclient. A server is not a push target, so the clients of@ably/pubsub-serveroffer onlypush.admin. On a server, manage push channel subscriptions withpush.admin.channelSubscriptions.- The
Pushplugin and thepushServiceWorkerUrlclient option are available only in@ably/pubsub-device.
Bundle and log changes
- MessagePack is a plugin for the web and React Native clients of
@ably/pubsub-deviceand for the CDN bundle, and is required to use the binary protocol there. SettinguseBinaryProtocol: truewithout passing theMsgPackplugin from@ably/pubsub-device/msgpackthrows error 40019. - The
@ably/pubsub-deviceweb, React Native, modular and CDN bundles strip most logs below error level. Use@ably/pubsub-device/debugor the debug CDN bundle to keep every log. - The CDN bundle's global is renamed from
AblytoAblyPubSub.
Removed APIs
- The
environment,restHostandrealtimeHostclient options are removed in favour ofendpoint. They are silently ignored, not rejected. - The
strictModeclient option is removed.channel.subscribe()without thesubscribemode always rejects, as doespresence.get()withoutpresence_subscribe. device(),Connection.recoveryKey, theably/promisesandably/callbacksentry points, the v1 callback overloads and the deprecated LiveObjects wire fields are removed.channels.release()throws unless the channel isinitialized,detachedorfailed.
Supported platforms changes
- Support for Node.js versions lower than 22 has been dropped.
- The published code, including the CDN bundle, targets ES2020 instead of ES2017.