This demo showcases a Flutter application that connects to a Socket.io server, facilitating bidirectional message communication. The setup comprises a client-side Flutter app and a Node.js-based Socket.io server.
Video Link : https://youtu.be/4OyyIzie91E
Implemented in Node.js with the 'express,socket.io' library, the server listens for Socket.io connections on port 5999 and efficiently manages incoming client messages.
- Ensure Node.js is installed on your machine.
- Navigate to the server directory: 'cd server'
- Install dependencies: 'npm install'
- Start the server: 'node index.js'
- The server initiates on 'http://localhost:5999' to accept Socket.io connections.
The Flutter client app connects seamlessly to the Socket.io server, enabling real-time message exchange. It leverages the 'socket_io_client' package for WebSocket communication.
- Confirm Flutter is installed on your machine.
- Navigate to the Flutter app directory: 'cd app'
- Install dependencies: 'flutter pub get'
- Connect your device or launch an emulator.
- Run the Flutter app: 'flutter run'
- Input the Socket.io server URL (e.g., 'http://localhost:5999')
- Once connected, utilize the input field to dispatch messages to the server and receive real-time responses.
- Message transmission to the server triggers upon pressing the "Send" button.
- Upon successful connection establishment, the server dispatches a welcoming "Hello, client!" message.
- Incoming messages from the server are promptly displayed within the app.
- The app incorporates predefined commands for seamless interaction with the server.
- Pressing the back button seamlessly disconnects the app from the server.
If you have any feedback, please reach out to us at dev.adnani26@gmail.com