Transport Layers
Understanding how Toolkit-P2P connects devices using Bluetooth, WiFi Direct, and hybrid transports.
Overview
Toolkit-P2P supports multiple transport layers to ensure your app works in any environment. Each transport has different characteristics, advantages, and limitations.
🔵 Bluetooth Low Energy
Bluetooth LE is the most reliable transport for offline connectivity. It works in airplane mode and has excellent cross-platform support.
Characteristics
Best For
- • Turn-based games
- • Chat applications
- • Small file transfers
- • Battery-sensitive apps
Usage
<P2PProvider transport="bluetooth"> <App /> </P2PProvider>
📡 WiFi Direct / Multipeer
WiFi Direct (Android) and Multipeer Connectivity (iOS) provide higher bandwidth and lower latency than Bluetooth, perfect for real-time gaming.
Characteristics
Best For
- • Real-time multiplayer games
- • Video/audio streaming
- • Large file transfers
- • High player count games
Usage
<P2PProvider transport="wifi"> <App /> </P2PProvider>
⚡ Hybrid Transport
The hybrid transport automatically selects the best available connection method and can seamlessly switch between transports as conditions change.
How It Works
Starts with Bluetooth discovery (always available) and simultaneously checks for WiFi Direct/Multipeer availability.
Prioritizes WiFi if available (faster), falls back to Bluetooth if not.
If WiFi connection drops, automatically switches to Bluetooth without disconnecting.
Usage
<P2PProvider transport="hybrid"> <App /> </P2PProvider>
📊 Comparison
| Feature | Bluetooth LE | WiFi Direct | Hybrid |
|---|---|---|---|
| Airplane Mode | ✓ Yes | ✗ No | ✓ Fallback |
| Low Latency | Good | Excellent | Excellent |
| Range | Short | Long | Long |
| Battery Life | Excellent | Good | Good |
| Setup Complexity | Simple | Moderate | Automatic |