Peer-to-Peer Data Streams
With BlackBerry Spark Communications Services, you can create true peer-to-peer connections that securely carry encrypted custom application data between two endpoints. These high-bandwidth connections allow you to create secure, real-time, and custom media streams or send application-specific protocol messages between endpoints for any purpose.
A data connection is a real-time secure connection created as the result of a data-only call.
Much like a voice or video call, the connection starts with an outgoing request to the callee carrying an optional meta data. Typically, the meta data contains description of the data connection for the callee to decide whether or not to accept the request.
After the incoming request is accepted by the callee, the data connection makes final security handshakes before making full connectivity. After full connectivity is made, data over the connection is encrypted using DTLS-SRTP and is peer-to-peer only.
The connection is maintained and kept active while the network path between the two endpoints remains reachable and there is data flowing. A timeout will terminate the connection after a number of seconds of inactivity. The number of seconds varies depending on the platform. If your application requires the connection to remain active, a pinging mechanism that uses a side data channel is needed.
Both endpoints of the connection can end the connection at any time. Typically, if there is no final acknowledgement from the receiver, the recipient should end the connection upon final data packet arrival.
An established connection could also drop due to network issues, in which case, the connection state will transition to disconnected and the failure reason is saved.
The following are some of the characteristics of the data connection.
- Secure: The connection provides end to end encryption.
- Real-time: The data can be transmitted with minimum latency.
- Reliable: The ordering of the data is always maintained. Lost data is always re-transmitted automatically.
- Full duplex support: Both endpoints can send and receive freely at the same time over the same connection.
- High bandwidth: Peer-to-peer data transmission allows for maximum utilization of the bandwidth.
- Protocol agnostic: With the
Streamtype data channel, additional protocol of signaling, handshaking, data resumption for more complex use cases can be implemented.
A total of 32 simultaneous data connections are supported and each is independently encrypted and transmitted.
A data channel sends and receives data of a particular type over a data connection.
Multiple data channels identified by unique names can be created on a single data connection. This eliminates the handshakes and negotiation overhead of a new connection. However, if data segregation is required, creating multiple data connections is preferred, as each data connection encrypts the data with a different key.
A data channel is automatically formed on one endpoint when a sender of a unique name is created, and is created on the other endpoint as a receiver when the first packet of the data arrives. Any subsequent data sent over the same channel will be received by the associated receiver identified by the unique name.
Some high level types of channels are defined in the table below. Your
application can extend the
Stream type for more complex use
cases as needed.
|Type||Purpose||Size||Large Data||Min latency||Auto Termination|
||files or large data||yes||yes||no||yes|
||low latency communication, or user defined||no||no||yes||no|
File type data channel allows the sending and receiving of
large data blobs. This channel automatically terminates when the file is
The underlining buffers are adjusted to allow maximum performance.
Data type data channel allows the sending and receiving of
data blobs. This channel automatically terminates when the data blob is
Stream type data channel allows the sending and receiving of
arbitrary data of an unknown total size. Data is immediately sent without
further buffering, and the channel stays open until the data connection