The main difference between Server message and P2P message is the delay and the presence of a server in the middle.


P2P Message


Server Message:


In P2P messaging, the messages are sent through the WebRTC Data Channel  (through the peer connection).

In Server messaging,  messages are sent through the Signalling Server. 

When you send a message to many peers through P2P messaging, you end up sending one-on-one messages to multiple people. 

The message is sent to the server which then broadcasts it to other peers.  

P2P will be faster, but might end up bloating the sending peer.

Relayed might add some latency, but is lighter on the sending peer.

P2P Messaging uses the RTCDataChannel where all data is secured with Datagram Transport Layer Security (DTLS).
Server messaging is useful when there are a lot of peers ( i.e.) to balance load. In the future, this would allow features such as asynchronous communication (e.g. store the message and send it when the user gets online).


SDKP2P MessageServer Message
Skylink SDK for WebsendP2PMessage
sendMessage
Skylink SDK for AndroidsendP2PMessage
sendServerMessage
Skylink SDK for iOSsendDCMessage
sendCustomMessage


Other articles you may be interested in: Where are chat messages stored?