A real-time chat application built with React and Socket.IO.
- Real-time messaging
- User presence (online/offline status)
- Typing indicators
- Message delivery status
- Split screen for testing two users
- Connection toggle for each user
-
Install dependencies:
npm install
-
Make sure your chat server is running on
http://localhost:3001 -
Start the application:
npm start
-
Open
http://localhost:3000in your browser
- The application shows two users side by side
- Each user can send messages to the other
- You can toggle connection status using the WiFi icon
- Typing indicators show when a user is typing
- Messages show delivery status
- Send messages between users
- Toggle online/offline status
- Watch typing indicators
- See real-time message delivery
- React
- Socket.IO Client
- Tailwind CSS
- Lucide React Icons
chat-app/
├── public/
│ └── index.html
├── src/
│ ├── components/
│ │ ├── ChatPanel.jsx
│ │ ├── MessageInput.jsx
│ │ ├── MessageItem.jsx
│ │ └── UserHeader.jsx
│ ├── services/
│ │ ├── AuthService.js
│ │ └── SocketService.js
│ ├── utils/
│ │ └── constants.js
│ ├── App.jsx
│ ├── App.css
│ └── index.js
├── package.json
├── tailwind.config.js
├── postcss.config.js
└── README.md
- On startup, the app syncs both users with the server using their JWT tokens
- Each user establishes a WebSocket connection
- Messages are sent in real-time between the two panels
- The WiFi icon in each panel allows toggling the connection on/off
- Typing status is shared when users are composing messages
- Online/offline status is updated automatically
You can modify the server URL and user credentials in src/utils/constants.js
- Ensure your chat server is running on
http://localhost:3001 - Check that the tokens in
constants.jsare valid - Look for connection errors in the browser console
- Verify both users are connected (green status indicator)
- Check the browser console for error messages
- Ensure the server is properly handling the socket events
- Run
npm installto ensure all dependencies are installed - Make sure Tailwind CSS is properly configured
- Clear browser cache if styles aren't loading