Is there a way to limit the number of connections to a socket.io server from the same IP address? For example, I could set the limit to 3, and then when someone opened 4 tabs to join the server, three of them would connect and the fourth or any after wouldn’t get connected. I’m not trying to cap t…
Tag: socket.io
Socket.IO in React app bundled with Vite doesnt work (When bundled with Webpack it does)
I have a Create React App that I migrated to Vite. I use socket.io-client. Both versions of the app are exactly the same (simply copy/paste) except the bundlers. This is my websocket connection In the webpack version I can see in the network tab that socket.io is attempting to connect. But in the vite version…
Is there a way to catch socket.io events without JavaScript in Flask?
My application handels a countdown, which refreshes all the time. The countdown itself is handeld by the server, like so: Currently I am catching the event data in JavaScript like this: Q.: Is there a way to catch socket.io events without JavaScript? If so, how could I do this? Answer If you are looking to re…
socket.io emitting to all clients works, but emitting to room doesn’t work
When I try io.emit(), the message gets emitted to everyone but when I try io.to(room).emit(), the message doesn’t get emitted (In the 3rd last line of the code). I manually checked the sockets in the room, and all are present in the room correctly. But the message never gets transmitted. Answer I was ab…
Screen sharing issue in WebRTC/nodejs with socket.io
im working on a vidoe conferencing application and I cant seem to get the screen sharing working getting an error “mediaTypeError: Cannot read properties of undefined (reading ‘getSender’)”. The screensharing is able to start but nothing is being shared This is my server file. Codes fo…
Socket listener not getting updates from React state
I have a component in which I set my state from the passed parameters to the component I set the activeList state from the passed params and then on click I update the state in order to show filtered results So ultimately users can filter their chat lists based on the chosen index And everything works fine, t…
Why is the client not receiving the socket.io broadcast (rooms)?
My client is not receiving the broadcast sent to the room. If I replace socket.to(roomName).emit(‘join’, currentUser); with socket.emit(‘join’, currentUser); the client receives the broadcast, but I’d like to use rooms here. Any help would be greatly appreciated. app.js game.ejs …
Socket in react is not listening for the second time
I’m very new to socket and trying to integrate socket in react and node.js simple CRUD application. My backend always emits the event and Frontend listens to the event. Below is the scenario I’m deleting an item from the list and for which I’m emitting an event from Backend after the record …
socket.io Get data io.sockets.clients(); Not working anymore
Before you can create objects with user properties on frontend and assign it to the socket.user property for each connection using a code like this ex below in the backend. then retrieve all these data through the sockets object eg. But now the io.sockets.clients is not working anymore and is not recognized a…
How to update state of array element during listener in React?
I’m working on a web app that reads sensor data to gauge objects via socket.io. The function addNewGauge() adds an element to the component’s array of gauges, but I also want to install a socket.io listener for that element. The addNewGauge() function works, and the listener is picking up the even…