How to use ably - 5 common examples

To help you get started, we’ve selected a few ably examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / ably / ably-tests.ts View on Github external
client.auth.requestToken((err, tokenDetails) => {
  // tokenDetails is instance of TokenDetails
  // see https://www.ably.io/documentation/rest/authentication/#token-details for its properties

  // Now we have the token, we can send it to someone who can instantiate a client with it:
  var clientUsingToken = new Ably.Realtime(tokenDetails.token);
});
github DefinitelyTyped / DefinitelyTyped / ably / ably-tests.ts View on Github external
import * as Ably from 'ably';

declare var console: { log(message: any): void };

const ApiKey = 'appId.keyId:secret';
const client = new Ably.Realtime(ApiKey);
const restClient = new Ably.Rest(ApiKey);

// Connection
// Successful connection:

client.connection.on('connected', () => {
  // successful connection
});

// Failed connection:

client.connection.on('failed', () => {
  //  failed connection
});
github DefinitelyTyped / DefinitelyTyped / ably / ably-tests.ts View on Github external
import * as Ably from 'ably';

declare var console: { log(message: any): void };

const ApiKey = 'appId.keyId:secret';
const client = new Ably.Realtime(ApiKey);
const restClient = new Ably.Rest(ApiKey);

// Connection
// Successful connection:

client.connection.on('connected', () => {
  // successful connection
});

// Failed connection:

client.connection.on('failed', () => {
  //  failed connection
});


// Subscribing to a channel
github ably / ably-js / Gruntfile.js View on Github external
'<%= dirs.crypto_js %>/hmac.js',
		'<%= dirs.crypto_js %>/enc-base64.js',

		'<%= dirs.browser %>/lib/util/domevent.js',
		'<%= dirs.browser %>/lib/util/msgpack.js',

		'<%= dirs.fragments %>/platform-browser.js',

		'<%= dirs.browser %>/lib/util/webstorage.js',
		ablyFiles,
		'<%= dirs.browser %>/lib/transport/jsonptransport.js',

		'<%= dirs.fragments %>/ably-commonjs-epilogue.js'
	);

	gruntConfig.concat['ably.d.ts'].src = [].concat(
		'ably.d.ts'
	);

	gruntConfig.bump = {
		options: {
			files: ['package.json', 'bower.json', 'README.md'],
			globalReplace: true,
			commit: true,
			commitMessage: 'Regenerate and release version %VERSION%',
			commitFiles: [], // Add files manually as can't add new files with a commit flag
			createTag: true,
			tagName: '%VERSION%',
			tagMessage: 'Version %VERSION%',
			push: false,
			prereleaseName: 'beta'
		}
github ably / ably-js / Gruntfile.js View on Github external
/* domevent omitted; not supported in nativescript */
		'<%= dirs.browser %>/lib/util/msgpack.js',

		'<%= dirs.fragments %>/platform-nativescript.js',

		'<%= dirs.browser %>/lib/util/crypto.js',

		/* Note: nativescript-specific webstorage */
		'<%= dirs.browser %>/lib/util/nativescript-webstorage.js',
		ablyFiles,
		/* jsonptransport omitted */

		'<%= dirs.fragments %>/ably-commonjs-epilogue.js'
	);

	gruntConfig.concat['ably.noencryption'].src = [].concat(
		'<%= dirs.fragments %>/license.js',
		'<%= dirs.fragments %>/ably-prologue.js',
		'<%= dirs.crypto_js %>/core.js',
		'<%= dirs.crypto_js %>/sha256.js',
		'<%= dirs.crypto_js %>/hmac.js',
		'<%= dirs.crypto_js %>/enc-base64.js',

		'<%= dirs.browser %>/lib/util/domevent.js',
		'<%= dirs.browser %>/lib/util/msgpack.js',

		'<%= dirs.fragments %>/platform-browser.js',
		'<%= dirs.browser %>/lib/util/webstorage.js',

		ablyFiles,
		'<%= dirs.browser %>/lib/transport/jsonptransport.js',

ably

Realtime client library for Ably, the realtime messaging service

Apache-2.0
Latest version published 12 days ago

Package Health Score

87 / 100
Full package analysis