The resource loading... loading...

Can you tell me a little bit about the use of long connections in websocket modules in Python?

Author: flyju, Created: 2021-05-02 23:28:35, Updated: 2021-05-02 23:31:12

import websocket

def on_message(wsapp, message):
    print(message)

def on_ping(wsapp, message):
    print("Got a ping!")

def on_pong(wsapp, message):
    print("Got a pong! No need to respond")

wsapp = websocket.WebSocketApp("wss://stream.meetup.com/2/rsvps",
  on_message=on_message, on_ping=on_ping, on_pong=on_pong)
    wsapp.run_forever(ping_interval=60, ping_timeout=10)

How can I extract the data returned to on_message from the outside? (not print out) Why is the code after 'wsapp.run_forever ((ping_interval=60, ping_timeout=10)'not executed? I've got a lot of people who don't understand Python, so I hope God will give me a call.


More

The grassSet up a global variable. See Dial function, which can be used directly in Python.

flyjuThank you.