#🔒 error websocket 404
11 messages · Page 1 of 1 (latest)
@uncut mist
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.
I will send the explanation
https://paste.pythondiscord.com/SSMQ
I'm trying to make a websocket connection with this link "wss://chat.modd.io/socket.io/?EIO=4&transport=websocket" but every time I try I get an error, I've been trying to do this for 3 days, this is a link to a game "https://www.modd.io/play/braainsio/" I found it by looking at the site, I gave f12, I went to network and found this link, and when I made a connection using an extension it connected and I started to receive chat messages, but when I try to pass it to Python I get this error:
Welcome to Braains.io! Can you survive the apocalypse? Navigate the chaotic town on foot, build forts with furniture and hunker down in rooms, or maybe even hide under a tree! The longer and deadlier your survival lasts, the more points you get, making you stronger and faster! If you get infected, don't fret! You can infect others and get 60% of...
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):
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()
the on_close() function takes 3 arguments
you defined it with only 1
1st is the WebSocket 2nd is the status code and the 3rd is the message.
def on_close(ws, close_status_code, close_msg):
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.