#🔒 websocket help

11 messages · Page 1 of 1 (latest)

shy ravine
#

.

wicked runeBOT
#

@shy ravine

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

shy ravine
#
import websocket


websocket_url = "wss://chat.modd.io/socket.io/?EIO=4&transport=websocket"

def on_message(ws, message):
    print(f"Recebido: {message}")

def on_error(ws, error):
    print(f"Erro: {error}")

def on_close(ws,close_status_code, close_msg):
    print("Conexão fechada")

def on_open(ws):
    print("Conexão aberta")


if __name__ == "__main__":

    websocket.enableTrace(True)
    ws = websocket.WebSocketApp(websocket_url,
                                on_message=on_message,
                                on_error=on_error,
                                on_close=on_close)
    ws.on_open = on_open


    ws.run_forever()
shy ravine
shy ravine
#

If I use an extension or a website to try to make a websocket connection, it works, but when I do the code in Python to connect it doesn't work

#

I've been trying to get this to work for 4 days and I still haven't managed to do it, if anyone can help me I would really appreciate it

wicked runeBOT
#

@shy ravine

Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.