File size: 819 Bytes
a0e7c0e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import socketio
import time

TOKEN = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOjEsInVzZXJuYW1lIjoidGVzdHVzZXIiLCJpYXQiOjE3ODMyNzk5NjksImV4cCI6MTc4NTg3MTk2OX0.gpgvpMgEumttey9egOV1UIrk7EGyandoYeRX6gpCckA"
BASE_URL = "https://Brighton233j-Messenger-back-database.hf.space"

sio = socketio.Client()

@sio.event
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"
    })

@sio.on("new_message")
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()