Skip to content
This repository was archived by the owner on Dec 20, 2021. It is now read-only.

Commit b7168a2

Browse files
committed
Create WebSocket Client.py
1 parent c4a99b0 commit b7168a2

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

examples/sync/WebSocket Client.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from vrcpy.wss import WSSClient
2+
import time
3+
4+
class Client(WSSClient):
5+
def on_friend_location(self, friend, world, location, instance):
6+
print("Friend changed world.")
7+
8+
def on_friend_offline(self, friend):
9+
print("Friend went offline.")
10+
11+
def on_friend_active(self, friend):
12+
print("Friend is now active.")
13+
14+
def on_notification(self, notification):
15+
print("Got a notification.")
16+
17+
def wait_loop(self):
18+
try:
19+
while True:
20+
time.sleep(1)
21+
except KeyboardInterrupt:
22+
self.logout()
23+
24+
def __init__(self):
25+
super().__init__()
26+
print("top: {}".format(hasattr(self, "loggedIn")))
27+
28+
self.login2fa(input("Username: "), input("Password: "), input("2FA Code: "), True)
29+
self.wait_loop()
30+
31+
c = Client()

0 commit comments

Comments
 (0)