A SwiftUI-based real-time chat application that supports offline functionality and real-time communication.
- 💬 Real-time messaging using WebSocket
- 📱 Single-screen chat interface
- 🔄 Offline message queuing and auto-retry
- 🚦 Robust error handling and connection management
- 📋 Chat preview list with unread indicators
- 🔀 Individual chat views
- 🔄 Automatic server fallback mechanism
- Platform: iOS
- Language: Swift
- Framework: SwiftUI
- Minimum iOS Version: iOS 15.0
- WebSocket Servers:
- Primary: wss://piehost.com/websocket-tester
- Fallback: wss://ws.postman-echo.com/raw
RealTimeChat/
├── Views/
│ ├── ChatView.swift # Main chat list view
│ ├── IndividualChatView.swift # Individual chat view
│ └── NewChatView.swift # New chat creation view
├── ViewModels/
│ └── ChatViewModel.swift # Main chat view model
├── Models/
│ ├── ChatMessage.swift # Message model
│ └── ChatPreview.swift # Chat preview model
├── Services/
│ ├── WebSocketManager.swift # WebSocket handling
│ └── NetworkMonitor.swift # Network connectivity monitoring
└── RealTimeChatApp.swift # App entry point
- WebSocket-based real-time messaging
- Automatic fallback to backup server if primary is unavailable
- Connection status monitoring and auto-reconnection
- Message queuing when offline
- Automatic retry when connection is restored
- Network status monitoring
- Clean, modern interface
- Unread message indicators
- Real-time updates without refresh
- Clear error states and notifications
- Xcode 14.0+
- iOS 15.0+
- Swift 5.5+
- Clone the repository
git clone https://github.com/mdiostest/RealTimeChat.git- Open the project in Xcode
cd RealTimeChat
open RealTimeChat.xcodeproj- Build and run the project
- Launch the app
- Create a new chat using the + button
- Start sending messages
- Messages will be queued if offline
- Queued messages are automatically sent when back online
The app handles various error scenarios:
- Network connectivity issues
- Server connection failures
- Message send failures
- Empty states
A demo video showcasing the app's features is available [here].
This project is licensed under the MIT License - see the LICENSE file for details.