An Interest In:
Web News this Week
- April 2, 2024
- April 1, 2024
- March 31, 2024
- March 30, 2024
- March 29, 2024
- March 28, 2024
- March 27, 2024
January 1, 2022 07:17 am GMT
Original Link: https://dev.to/deepakjaiswal/socketio-use-as-real-time-application-like-chatting-gamming-in-react-or-any-application-in-express-3720
Socket.io Use as Real Time Application like Chatting Gamming in React ,Or Any Application in Express
hello today we discuss a famous library for real time application
like chat app, gamming room etc.
socket.io is a server side library. its use in backend to send messages
that send bye user store the message and we send their message to client.
socket-client.io is a frontend library to connect server and using server link.
client emit the message to the server and server on their emit and server emit their message
and client on their emitted message into frontend side.
before message we make connection between so
//server.jsio.on('connection',(socket)=>{console.log("connected")socket.on('send_message',(msg)=>{socket.emit('send_message',msg);});socket.on('disconnect',()=>{console.log("disconnect")})});
//client.jslet msg="hi i am sandeep"socket.emit('send_message',msg);socket.on('send_message',msg=>{console.log(msg)});
Original Link: https://dev.to/deepakjaiswal/socketio-use-as-real-time-application-like-chatting-gamming-in-react-or-any-application-in-express-3720
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To