You can create two types of OpenTok sessions - Relayed, which are peer-to-peer, and Routed, which go through TokBox's media server.
Though there are only two types of Sessions, there are three different ways that media streams can be sent:
1. Relayed (Peer-to-Peer) sessions in which the audio/video streams are sent between the users directly.
2. Relayed (Peer-to-Peer) sessions in which the audio/video streams are sent through OpenTok Relay Servers due to an inability to connect directly to their peer. This happens because one or both the users are located behind a firewall.
3. Routed sessions are explicitly routed through OpenTok Media Servers. This provides a number of features such as Archiving, reduced upload bandwidth in group calls, and Audio Only Fallback.
- A Relayed session offers the benefit of reduced latency. By having end users directly connect to each other, there are fewer network hops.
- The downside of using a Relayed stream is that you will not be able to to take advantage of various rich features that TokBox Media Servers provide such as Archiving, Audio Only Fallback, as well as reducing upload bandwidth for group calls.
- Reduced upload bandwidth - If a publisher is streaming to multiple subscribers, he sends just one stream to the Media Server. The Media Server replicates the streams and sends them out to all subscribers. This way, the publisher's upload bandwidth consumption is reduced.
- Archiving - Archiving is possible only if a session is routed because it is the Media Server that records the stream. Relayed (peer-to-peer) sessions cannot be archived.
- Audio-Fallback - If the Media Server detects that there are bandwidth limitations on a Subscriber's network, then it automatically switches the subscriber to a "Audio-Only" mode.
- The main drawback of using a Routed stream is that there may be some latency added vs connecting directly to a peer. In most cases this should not be a problem, but in certain low bandwidth situations it can be a factor.