If you've ever used browser-based file sharing tools (like Snapdrop, PairDrop, or older versions of Textunnel), you know the drill:
- Open the website on your PC.
- Open the website on your phone.
- Look at the screen to find a 6-digit room code.
- Type the room code into the other device to connect.
While this is miles better than emailing yourself a file, it still has friction. Apple's AirDrop doesn't ask you for a 6-digit code. Why should your browser-based sharing tool?
Today, we are thrilled to announce Seamless Persistent Device Pairing for Textunnel.
The Problem with Traditional WebRTC Signaling
WebRTC is the magic underlying technology that allows browsers to send files directly to each other without touching a cloud server. However, WebRTC requires a "Signaling Server" (like our MQTT broker) to help the two devices find each other's IP addresses.
Usually, developers use a "Room Code" as the rendezvous point. If both devices subscribe to the topic Room-123456, they can find each other. But if you don't type the code, they are completely invisible to one another.
How Persistent Pairing Fixes This
We decided to engineer an entirely new discovery protocol. Here is how it works:
1. The Initial Trust Handshake
The very first time you connect your Mac and your iPhone via Textunnel (using a room code or QR code), they establish a secure WebRTC connection.
Behind the scenes, the devices silently exchange their anonymous deviceIds. Your Mac saves your iPhone's ID into its local storage, marking it as a "Trusted Peer".
2. The Personal Inbox (MQTT Auto-Discovery)
Now, the magic happens. The next time you open Textunnel on your Mac, it doesn't just sit there waiting for a room code.
Instead, it actively subscribes to a personal, hidden inbox: lan-drop/user/<Mac-ID>. At the exact same time, it sends out a silent "Ping" message to the inbox of every device it has ever trusted.
3. Click to Connect
If your iPhone happens to have Textunnel open, it receives the Mac's Ping and instantly replies with a Pong.
Suddenly, your iPhone appears on your Mac's screen under a new "My Devices" list with a glowing green "Online" indicator!
You just click your iPhone's icon, and Textunnel automatically:
- Generates a cryptographically secure random room code.
- Sends a silent "Invite" to your iPhone.
- Forces both devices to instantly jump into the secure room and establish a WebRTC connection.
Why This Matters
This brings the "AirDrop Experience" to the open web.
- No more typing codes.
- No user accounts required. Your identity is tied cryptographically to your device's browser, not an email address or password.
- Works across OS boundaries. Windows, Mac, iOS, Android, Linux—it doesn't matter. If they have a browser, they can auto-pair.
Try It Now
Ready to experience it? Open Textunnel on your computer and your phone. Connect them once manually. Then, close the tabs, reopen them, and watch them automatically discover each other!