Just a few days after the first update I figured out how to use WebRTC, which I shortly after implemented into Meshenger.
To shortly describe the way signalling is working in my app:
- On phone A a call to phone B is issued by tapping the contact, hence phone A already knows the destination address
- A sends a call request to B, which B may accept or decline. This is done through a custom JSON-based protocol designed by me
- In case of success A creates a Session Description, also called SDP offer, which it transmits to B, using the same protocol
- B creates an SDP answer which it transmits back to A, still using my JSON-based protocol
- Using the exchanged offer and answer a RTCPeerconnection is established, where the data is transmitted through separate DataChannels/Streams. Upon this moment, WebRTC handles all the communication
- Finally, the phones have a RTCPeerconnection which they use to send Audio/Video as well as service messages, e.g. when a camera is connected
Besides the sheer implementation of WebRTC the front/back camera can be turned on and even switched on the fly.
The app has undergone some graphical improvements, all buttons containing text has been replaced with Image Buttons,
many of them even show a animation depending on their effect.
I even tried to cover the case of the user switching a network, if the link-local address loses its reachability.
Instead of simply trying to reach the last known address, the app now examines every address the phone has
and tries to replace its own MAC address in those addresses with the MAC of the target.
This leads to a higher chance of re-finding a contact even if the phones have switched networks.
As you can see in the following screenshot, bidirectional video-transmission is enabled, and the buttons at the bottom now have cute icons.
From now on I will focus on polishing the app, cleaning the source code, finding and resolving bugs and,
last but not least, writing sufficient documentation.
I may even write a blog post somewhere, explaining how to archieve a serverless WebRTC connection,