Peer-to-peer connections

You can use the BlackBerry Messenger platform to create and manage peer-to-peer connections between BlackBerry devices. The BlackBerry Messenger SDK provides APIs that you can use to build applications that leverage peer-to-peer connections, so that BlackBerry device users can connect with their BBM contacts and can have a shared experience within your application.

Your application can open a channel connection or a session connection.

Connection

Connection type

Description

Channel

Private

When a channel connection is opened, a user can communicate directly with one or more contacts, but the contacts are not aware of each other. Each contact can only communicate with the user. For example, a channel connection could be used when a user wants to have a private chat with a contact, or wants to send their location information to one or more contacts.

Session

Open

When a session connection is opened, a user can invite one or more contacts to interact. The contacts are aware of each other. These contacts may invite their own contacts, who are also visible to everyone in the session, whether or not they are contacts of the session originator. Data that is sent by a user in the session is sent to every other user in the session. For example, a session connection could be used for a multi-player game application such as a poker game, where all the users in the session can see the poker table, and game data is sent to each player in the game as it occurs.

The BBM platform is designed to handle much of the complexity of a session connection. When you create an application such as a multi-player game, you need not worry about the programmatic logic around managing the session. The platform can handle session management on a peer-to-peer level, so no server-side component is required. In addition, the platform can manage the users. Each user in the session is notified as other users join or leave, and the connection is maintained until the last user leaves the session.

The BBM platform tracks which contacts are active on the connection. Contacts are active until they leave the connection, the connection is closed, or your application is closed. If a contact leaves the connection, they cannot join again unless the originating user sends them another invitation.

The BBM platform also keeps track of contacts who have been sent an invitation but have not yet joined a connection.

Previous topic: Features

Was this information helpful? Send us your comments.