hello, I used the code and add print message on_close.
from wsocket import WSocketApp, WebSocketError, logger, run
from time import sleep
logger.setLevel(10) # for debugging
def on_close(self, message, client):
print("come to the on_close_____________")
print(repr(client) + " : " + message)
def on_connect(client):
print(repr(client) + " connected")
def on_message(message, client):
print(repr(clent) + " : " + repr(message))
try:
client.send("you said: " + message)
sleep(2)
client.send("you said: " + message)
except WebSocketError:
pass
app = WSocketApp()
app.onconnect += on_connect
app.onmessage += on_message
app.onclose += on_close
run(app)
the message above is I run the hello_world.py.
when I closed the websocket connect by the client. It did not go the the " on_close(self, message, client):" ,and not print the message :"come to the on_close_____________"
Some one can try to check the code and tell me why not message is printed on_close?
Thank you!