-
Notifications
You must be signed in to change notification settings - Fork 1
/
testRequests.py
48 lines (35 loc) · 1.27 KB
/
testRequests.py
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# from pythonosc.udp_client import SimpleUDPClient
# from vicon_core_api import *
# from shogun_live_api import *
# from pythonosc import osc_server
# from pythonosc.dispatcher import Dispatcher
# import asyncio
# async def slaap():
# await asyncio.sleep(2)
# ip = "192.168.0.180"
# port = 8005
# client = SimpleUDPClient(ip, port)
# # client.send_message("/RecordStart", [])
# # asyncio.run(slaap())
# # client.send_message("/RecordStop", [])
# client.send_message("/CloseTCPListener", [])
# client.send_message("/QuitServer", [])
# # client.send_message("/SendFileNameToTCP", ["testFile"])
# client.send_message("/Alive", [])
import asyncio
import websockets
async def send_messages():
uri = "ws://192.168.0.180:8009"
async with websockets.connect(uri) as websocket:
# Send "greet" message
# await websocket.send("greet:Hello, Server!")
await websocket.send("ping:a")
await websocket.send("fileName:test0204")
await asyncio.sleep(5)
await websocket.send("recordStart:starting the recording")
await asyncio.sleep(10)
await websocket.send("recordStop:stopping the recording")
await asyncio.sleep(2)
# Send "close" message
await websocket.send("close:a")
asyncio.run(send_messages())