If you need to share information between two connected points we have two possible solutions:
1. Send information via the message system
Could be implemented via SendMessageToPeer
Check out the Streamer/Receiver samples in %SDK_installation_path%\MPlatform SDK\Samples WebRTC\C#
For example:
In the Streamer sample, we are trying to send a message via
MainForm.cs lines 204-208
//with "" as peerID, message will be sent to all connected peers m_objWebRTC.SendMessageToPeer("", textBoxMessage.Text);
In Receiver sample, we have a WebRTC event listener MainForm.cs lines 58-62
Where bsEventName = "message" and bsEventParam = message string value
private void M_objWebRTC_OnEventSafe(string bsChannelID, string bsEventName, string bsEventParam, object pEventObject) { textBoxMessages.AppendText(string.Format("From: {0}, Type: {1}, Param: {2}\r\n", bsChannelID, bsEventName, bsEventParam)); releaseComObj(pEventObject); }
2. Send information via custom properties.
Please note that all custom properties should have the prefix - "remote."
For example:
Setting the custom property
m_objWebRTC.PropsSet("remote.CustomProps","value");
Getting the custom property
int nPeersCount;
string strPeerId, strHelp;
//Enumerate peers in room
m_objWebRTC.PropsOptionGetCount("peers_in_room", out nPeersCount);
for (int i = 0; i < nPeersCount; i++)
{
m_objWebRTC.PropsOptionGetByIndex("peers_in_room", i, out strPeerId, out strHelp);
int nPropsCount, nNode = 0;
string strPropertyName, strPropertyValue = "";
//Get exact peer properties
m_objWebRTC.PropsGetCount("attributes_info::peers_in_room::" + strPeerId, out nPropsCount);
for (int j = 0; j < nPropsCount; j++)
{
m_objWebRTC.PropsGetByIndex("attributes_info::peers_in_room::" + strPeerId, j, out strPropertyName, out strPropertyValue, out nNode);
//Here we'll have all peer props including custom ones
}
}