Transmission modes of the Bridgefy SDK
The basis for the functioning of Bridgefy is to make messages hop on nearby devices until they reach the intended recipient.
Sounds easy, doesn’t it? We thought so too, but we found that it wasn’t so, so we dedicated many hours to make that which sounds easy remain that way for all those who use our SDK.
After many meetings, testing, correction of errors, simulations, and even complete changes of approach, we completed the product that we released earlier this year. Since the release, we’ve had contact with many developers to invite them to try our SDK and to listen to their questions and ideas for its use. On the feedback that we’ve received, there’s a question that has become recurrent:
What do I have to do in my app to make message forwarding work?
The short answer is nothing. Because the algorithm that we implemented within the SDK is responsible for the management of messages that have to be forwarded to the addressee; these messages pass through the phone without the user or developer realizing it.
A message shared using the Bridgefy SDK can contain the information serialized in a dictionary or raw data. A message can be sent using any of the next 3 methods:
On this methods we set the info we want to share, the receiver user and how we want to share the message. In case of error there’s a pointer to get it and if no errors occurs we get a string with the id assigned to the message by the SDK.
We will focus on the parameter that indicates how we want to share the message, which is an enum called BFSendingOption with the following values:
The first 3 values and the last one are the ones that define the way we want to send the message, and we believe, are sufficient to handle the different scenarios in which you want to send a message.
BFSendingOptionDirectTransmission
It’s used to send messages one by one between two devices, as long as they’re in range. This method doesn’t make use of nearby devices.
BFSendingOptionMeshTransmission
Same as direct transmission, mesh transmission serves to send messages one by one between 2 devices, but this mode does make use of the devices that are available nearby. Thus, a message sent using mesh mode will hop from phone to phone until it reaches the recipient. It’s important to clarify that none of the devices in which a message passes through before reaching its destination, have access to it.
BFSendingOptionFullTransmission
This mode combines direct and mesh transmission methods.
BFSendingOptionBroadcastReceiver
Finally, broadcast transmission is based on the mesh mode principle, but with the difference that messages can be from one to many, i.e., there’s no specific recipient, so all the phones that receive the message will be able to have access to it.
After initializing the SDK, developers will only have to worry about choosing the best mode for their messages and from then on, the Bridgefy SDK will take care of everything else.