Getting Started

Before hacking away, you'll need a home for your data. The first step in using Convergence is to log in to the web-based Convergence Administration Console and either create a domain or verify the information for an existing domain you wish to use. Make sure that this domain has at least one user, as you will need that user's credentials to connect to the domain.

Domains

Domains provide an organizational structure for your applications. Convergence users (you, not your application's end user) can create and use multiple domains. Each domain has its own set of users, data, security rules, etc. In essence, each domain is its own entire collaborative ecosystem. Having multiple domains is convenient if you have multiple applications, or if you have a production application and would like to have a sandbox to play in without affecting your production users.

JavaScript / HTML Setup

Convergence requires a few things to get going. First you need the convergence client. Since Convergence uses RxJs, you also need to include the RxJs client as well. The quickest way to get started is to add the following HTML to the head tag of your page:

<html>
  <head>
    <script src="https://cdn.convergence.io/latest/convergence-all.js"></script>
  </head>
</html>

We plan on offering several bundling and script loading options in the future, such as bundling RxJS and providing AMD, CommonJS, and ES6 modules. For now, though, this is the simplest way to get started. Ensure that the RxJS script tag is added BEFORE the Convergence client.

Connecting

The first step after setup is to connect to your domain. The simplest way to connect is using a username and password for a domain user. The connect method returns a promise that will either complete with the connected domain, or will be rejected with an error detailing why the connection was not successful.

var domainUrl = "https://api.convergence.io/realtime/domain/<username>/<domainId>";
Convergence.connect(domainUrl, "Bruce Wayne", "1AmBatman!").then(domain => {
  // Connection success! See below for the API methods available on this domain
}).catch(err => {
  console.log(err);
});

You can see the available connection methods in the Authentication section.

Services

The domain is the main entry point into the convergence API. The features it provides are grouped into high level services. Getting to know these services is the next step in learning how to use Convergence to build a collaborative app.

  • Identity Service: Provides services to obtain information on the identity of users in the system.
  • Presence Service: Provides services to see who is available in the system and publish shared state.
  • Model Service: Provides services to store, retrieve, and edit shared data models.
  • Activity Service: Provides services to more gradually communicate who is doing what in an application.
  • Chat Service: Provides services for users to send messages to each other to coordinate actions and share information.

Each service is discussed in detail in subsequent chapters.

Next Steps

The next few chapters will explore the various ways to connect / authenticate, how to interact with the ConvergenceDomain and the various services it provides.

results matching ""

    No results matching ""