| import socketio | |
| import time | |
| TOKEN = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOjEsInVzZXJuYW1lIjoidGVzdHVzZXIiLCJpYXQiOjE3ODMyNzk5NjksImV4cCI6MTc4NTg3MTk2OX0.gpgvpMgEumttey9egOV1UIrk7EGyandoYeRX6gpCckA" | |
| BASE_URL = "https://Brighton233j-Messenger-back-database.hf.space" | |
| sio = socketio.Client() | |
| def connect(): | |
| print("Connected as testuser! Sending to stranger_test (id 7)...") | |
| sio.emit("send_message", { | |
| "token": TOKEN, | |
| "recipient_id": 7, | |
| "content": "Hey, we're not friends yet — this should be a request" | |
| }) | |
| def on_message(data): | |
| print(f"[msg] is_request={data.get('is_request')} content={data['content']}") | |
| sio.connect(f"{BASE_URL}?token={TOKEN}", socketio_path="/socket.io", transports=["websocket"]) | |
| time.sleep(4) | |
| sio.disconnect() | |