miguelgrinberg / Flask-SocketIO-Chat

A simple chat application that demonstrates how to structure a Flask-SocketIO application.
http://blog.miguelgrinberg.com/post/easy-websockets-with-flask-and-gevent
MIT License
676 stars 242 forks source link

Server receives event correctly, but It doesn't execute method #17

Closed sbqsbqsbq closed 6 years ago

sbqsbqsbq commented 6 years ago

I have written my code as the below. I pretended to print sentence when the event named 'my event' occurred.

@socketio.on("my event", namespace="/v1/chat")
def my_event():
    logging.info("Listening My Event")

However, It doesn't execute method. The below is logcat from my flask sever.

12-07-2018:06:58:31,132 INFO     [socket.py:52] b9b1bbe8e27541a9837476022e7e9b89: Received packet MESSAGE data 2/api/v1/chat,["my event",{"data":"I'm connected!"}]
12-07-2018:06:58:31,132 INFO     [server.py:453] received event "my event" from b9b1bbe8e27541a9837476022e7e9b89 [/api/v1/chat]

How can I solve this problem?

miguelgrinberg commented 6 years ago

Duplicate of https://github.com/miguelgrinberg/Flask-SocketIO/issues/738, closing.