The main difference between Server message and P2P message is the delay and the presence of a server in the middle
- In P2P messaging, the messages are sent through the WebRTC Data Channel (through the peer connection.)
- When you send a message to many peers through P2P messaging, you end up sending one-on-one messages to multiple people.
- P2P will be faster, but might end up bloating the sending peer.
- P2P Messaging uses the RTCDataChannel where all data is secured with Datagram Transport Layer Security (DTLS).
- In Server messaging, messages are sent through the Signalling Server.
- The message is sent to the server which then broadcasts it to other peers.
- Relayed might add some latency, but is lighter on the sending peer.
- Server messaging is useful when there are a lot of peers ( i.e.) to balance load.
- This would allow (in the future) features such as asynchronous communication (e.g. store the message and send when the user comes online).
|SDK||P2P Message||Server Message|
|Skylink SDK for Web||sendP2PMessage||sendMessage|
|Skylink SDK for Android||sendP2PMessage||sendServerMessage|
|Skylink SDK for iOS||sendDCMessage||sendCustomMessage|