Add CLI run options, update README
This commit is contained in:
@@ -9,7 +9,8 @@ from websocket import create_connection
|
||||
|
||||
from cmd_chat.client.core.crypto import RSAService
|
||||
from cmd_chat.client.config import (
|
||||
COLORS
|
||||
COLORS,
|
||||
RENDER_TIME
|
||||
)
|
||||
|
||||
|
||||
@@ -109,13 +110,13 @@ class Client(RSAService):
|
||||
def update_info(self):
|
||||
""" connecting to websocket,
|
||||
wating for updates,
|
||||
updating every 0.05 seconds
|
||||
updating every RENDER_TIME seconds
|
||||
"""
|
||||
ws = create_connection(f"{self.ws_url}/update")
|
||||
last_try = None
|
||||
while True:
|
||||
try:
|
||||
time.sleep(0.05)
|
||||
time.sleep(RENDER_TIME)
|
||||
response = ast.literal_eval(ws.recv().decode('utf-8'))
|
||||
if last_try == response:
|
||||
continue
|
||||
|
||||
@@ -5,4 +5,6 @@ COLORS = {
|
||||
"my_username_color": Fore.MAGENTA,
|
||||
"ip_color": Fore.MAGENTA,
|
||||
"username_color": Fore.GREEN
|
||||
}
|
||||
}
|
||||
|
||||
RENDER_TIME = 0.05
|
||||
Reference in New Issue
Block a user