A peer-to-peer chat application for Android that mirrors the iOS implementation exactly. Uses WebRTC for direct communication and WebSocket signaling server.
- Real-time P2P messaging using WebRTC data channels
- Same signaling server and TURN/STUN configuration as iOS app
- Automatic reconnection on connection loss
- Room-based chat system
- Cross-platform compatibility with iOS version
cd /home/botond/AndroidStudioProjects/Vortex
./gradlew installDebug- Launch the app - it will automatically connect to the signaling server
- Wait for "Connected" status - the status should change from "Connecting" to "Connected"
- Enter a Room ID (or leave blank for "default") and tap "Join Room"
- Chat with other users - open the iOS app or another Android instance in the same room
- Send messages - the "Send" button becomes enabled when P2P connection is established
- ChatManager.kt - WebRTC peer connection management, WebSocket signaling, message handling
- MainActivity.kt - Simple UI with status, room controls, message list, and input
- ConnectionStatusAndroid - Connection state enum (DISCONNECTED, CONNECTING, CONNECTED)
- ChatMessage - Data class for individual messages with timestamp and sender info
- Signaling Server:
wss://chat.ballabotond.com - STUN Servers: Google STUN servers for NAT traversal
- TURN Servers:
- Primary:
chat.ballabotond.com:3478(UDP/TCP/TLS) - Fallback:
openrelay.metered.ca(UDP/TCP)
- Primary:
- WebSocket connects to signaling server
- Server sends "connected" message with client ID
- User joins room via "join_room" message
- When second user joins, server sends "room_ready" with initiator flag
- Initiator creates offer and data channel
- WebRTC negotiation (offer/answer/ICE candidates) via signaling
- P2P data channel opens for direct messaging
Enable verbose logging to see connection details:
adb logcat | grep ChatManagerKey log messages to watch for:
🔧 Setting up WebRTC...- WebRTC initializationWebSocket opened - waiting for server confirmation- WebSocket connectionConnected to signaling server with ID: <id>- Successful server connection🎯 Room is ready! Both users connected- Room pairing successful🟢 Data channel: Open! Ready to send messages- P2P connection established📥 Received P2P message: '<message>'- Message received
- Single device: Use both Android and iOS apps
- Multiple devices: Install on different devices, same room ID
- Network conditions: Test on different networks (WiFi, mobile data)
- Connection recovery: Kill and restart app to test reconnection
- Stream WebRTC:
io.getstream:stream-webrtc-android:1.0.7 - OkHttp:
com.squareup.okhttp3:okhttp:4.12.0 - Gson:
com.google.code.gson:gson:2.10.1 - Kotlinx Coroutines:
org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1
- Android API Level: 26+ (Android 8.0)
- Target SDK: 35
- Architecture: ARM64, ARMv7, x86, x86_64
- Cross-platform: Compatible with iOS version using same protocols