diff --git a/Gruntfile.js b/Gruntfile.js
index a173c6913..3bd1b0c23 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -125,8 +125,11 @@ module.exports = function (grunt) {
grunt.registerTask('build:push', function () {
var done = this.async();
- esbuild
- .build(esbuildConfig.pushPluginConfig)
+ Promise.all([
+ esbuild.build(esbuildConfig.pushPluginConfig),
+ esbuild.build(esbuildConfig.pushPluginCdnConfig),
+ esbuild.build(esbuildConfig.minifiedPushPluginCdnConfig),
+ ])
.then(() => {
done(true);
})
diff --git a/README.md b/README.md
index 958742583..1b7828c41 100644
--- a/README.md
+++ b/README.md
@@ -74,7 +74,7 @@ Include the Ably library in your HTML:
```
-The Ably client library follows [Semantic Versioning](http://semver.org/). To lock into a major or minor version of the client library, you can specify a specific version number such as https://cdn.ably.com/lib/ably.min-1.js for all v1._ versions, or https://cdn.ably.com/lib/ably.min-1.0.js for all v1.0._ versions, or you can lock into a single release with https://cdn.ably.com/lib/ably.min-1.0.9.js. Note you can load the non-minified version by omitting `min-` from the URL such as https://cdn.ably.com/lib/ably-1.0.js. See https://github.com/ably/ably-js/tags for a list of tagged releases.
+The Ably client library follows [Semantic Versioning](http://semver.org/). To lock into a major or minor version of the client library, you can specify a specific version number such as https://cdn.ably.com/lib/ably.min-1.js for all v1._ versions, or https://cdn.ably.com/lib/ably.min-1.0.js for all v1.0._ versions, or you can lock into a single release with https://cdn.ably.com/lib/ably.min-1.0.9.js. Note you can load the non-minified version by omitting `.min` from the URL such as https://cdn.ably.com/lib/ably-1.0.js. See https://github.com/ably/ably-js/tags for a list of tagged releases.
For usage, jump to [Using the Realtime API](#using-the-realtime-api) or [Using the REST API](#using-the-rest-api).
@@ -567,6 +567,23 @@ await channel.push.unsubscribeClient();
Push activation works with the [Modular variant](#modular-tree-shakable-variant) of the library, but requires you to be using the Rest plugin.
+Alternatively, you can load the Push plugin directly in your HTML using `script` tag (in case you can't use a package manager):
+
+```html
+
+```
+
+When loaded this way, the Push plugin will be available on the global object via the `AblyPushPlugin` property, so you will need to pass it to the Ably instance as follows:
+
+```javascript
+const client = new Ably.Rest({
+ ...options,
+ plugins: { Push: AblyPushPlugin },
+});
+```
+
+The Push plugin is developed as part of the Ably client library, so it is available for the same versions as the Ably client library itself. It also means that it follows the same semantic versioning rules as they were defined for [the Ably client library](#for-browsers). For example, to lock into a major or minor version of the Push plugin, you can specify a specific version number such as https://cdn.ably.com/lib/push.umd.min-2.js for all v2._ versions, or https://cdn.ably.com/lib/push.umd.min-2.3.js for all v2.3._ versions, or you can lock into a single release with https://cdn.ably.com/lib/push.umd.min-2.3.2.js. Note you can load the non-minified version by omitting `.min` from the URL such as https://cdn.ably.com/lib/push.umd-2.js.
+
For more information on publishing push notifcations over Ably, see the [Ably push documentation](https://ably.com/docs/push).
## Delta Plugin
diff --git a/grunt/esbuild/build.js b/grunt/esbuild/build.js
index 7fc89e32a..52fba2e81 100644
--- a/grunt/esbuild/build.js
+++ b/grunt/esbuild/build.js
@@ -62,10 +62,27 @@ const pushPluginConfig = {
external: ['ulid'],
};
+const pushPluginCdnConfig = {
+ ...createBaseConfig(),
+ entryPoints: ['src/plugins/push/index.ts'],
+ plugins: [umdWrapper.default({ libraryName: 'AblyPushPlugin', amdNamedModule: false })],
+ outfile: 'build/push.umd.js',
+};
+
+const minifiedPushPluginCdnConfig = {
+ ...createBaseConfig(),
+ entryPoints: ['src/plugins/push/index.ts'],
+ plugins: [umdWrapper.default({ libraryName: 'AblyPushPlugin', amdNamedModule: false })],
+ outfile: 'build/push.umd.min.js',
+ minify: true,
+};
+
module.exports = {
webConfig,
minifiedWebConfig,
modularConfig,
nodeConfig,
pushPluginConfig,
+ pushPluginCdnConfig,
+ minifiedPushPluginCdnConfig,
};
diff --git a/scripts/cdn_deploy.js b/scripts/cdn_deploy.js
index d660ba53e..761f2e379 100755
--- a/scripts/cdn_deploy.js
+++ b/scripts/cdn_deploy.js
@@ -12,7 +12,7 @@ async function run() {
let config = {
// The S3 Bucket to upload into
bucket: S3_DEFAULT_BUCKET,
- // The root folder inside the S3 bucket where the files should be places
+ // The root folder inside the S3 bucket where the files should be placed
root: S3_DEFAULT_ROOT,
// Local path to start from
path: '.',
@@ -21,7 +21,7 @@ async function run() {
// Comma separated directories (relative to `path`) to exclude from upload
excludeDirs: 'node_modules,.git',
// Regex to match files against for upload
- fileRegex: '^ably?(\\.min)?\\.js$',
+ fileRegex: '^(ably|push\\.umd)?(\\.min)?\\.js$',
...argv,
};