1 year ago
#76245

Avik Pradhan
How to emmit event through python socket io? It is working on my local machine but i am having hard time figuring out to run in server
I am not being able to emmit event through python socket io in server. Can somebody help me i am able to do it in my local machine. I think it is problem with namespace but i am not being able to figure it out.
- my server.py *
@sio.event
def connect(sid, environ):
game_id = environ.get("HTTP_GAME_ID", "")
sio.enter_room(sid, game_id)
def my_function(data, game_id):
sio.emit("my_event", {"data": data}, to=game_id, namespace='/join-game')
- nginx.config *
location /join-game {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://<my-ip>;
}
I connect from url:
http://<my-ip>/join-game
When i am listening to my_event it does not emit event.
python
django-rest-framework
websocket
socket.io
python-socketio
0 Answers
Your Answer