socket emitting same data to different clients #1786
Unanswered
vrajeshbhatt
asked this question in
Q&A
Replies: 1 comment 5 replies
-
You are using global variables. How does that work when you have two or more clients? |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello there,
In my project, I am using flask socketio as a server and socket io for the client (javascript).
In flask, there is a function for sending the data to client which is connected with sid. The issue I am facing is when multiple user/client connects the data which is the server/flask function is sending is somehow mixing up.
for example, if user A and B are there and accessing the same exercise page (javascript client) so if user A do some exercise which leads to some result that comes from the server (flask socketio) is reflected on both side client A and B.
Even I am checking the session id with the conditions with the request.sid in server-side and socket.id in client-side. But the issue is the same.
client side code
server side code
I also tried
socket.emit('recv_data',{'points':high_knee_points,'rep_count':rep_count,'id':request.sid})
andemit('recv_data',{'points':high_knee_points,'rep_count':rep_count,'id':request.sid},to=request.sid)
But still facing the same issue.
I will appreciate it if you tell me what is the problem and some solutions for the same.
Beta Was this translation helpful? Give feedback.
All reactions