How to use the ably.Realtime function in ably

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
});

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