From cf3babf3de57e40d890c20c05089f8d53f75588c Mon Sep 17 00:00:00 2001 From: Silver Kuusik Date: Wed, 12 Sep 2018 14:35:53 +0200 Subject: [PATCH] update websocket url and messages --- main.py | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/main.py b/main.py index b596e2b..ffb676c 100755 --- a/main.py +++ b/main.py @@ -2,12 +2,6 @@ import _thread import ubinascii import uwebsockets -# Extract a unique name for the robot from the device MAC address -mac = ubinascii.hexlify(wlan.config("mac")[-3:]).decode("ascii") - -# SumoRobot server -server_url = config["sumo_server"] - # Code to execute ast = "" # Scope, info to be sent to the client @@ -23,7 +17,6 @@ def step(): sumorobot.is_line(RIGHT) # Update scope scope = dict( - to = "browser-%s@00000514" % mac, line_left = sumorobot.get_line(LEFT), line_right = sumorobot.get_line(RIGHT), opponent = sumorobot.get_opponent_distance(), @@ -105,17 +98,12 @@ while not wlan.isconnected(): sleep_ms(100) # Connect to the websocket +url = config['sumo_server'] + "/p2p/" + config['sumo_id'] + "/broswer" conn = uwebsockets.connect(url) # Set X seconds timeout for socket reads conn.settimeout(1) -# Send a ping to the robot -conn.send('{"setID": "sumo-%s@00000514", "passwd": "salakala"}' % mac) -# Receive session and auth ok frames -conn.recv() -conn.recv() - # Stop bootup blinking timer.deinit()