Hi guys, I found the code in lesson 3(senors-and-actuators) not work in my browser.
I tried both in win10 and macOS, and both old version or new version of counterfit.
The situation is when you open your chrome dev tools and lookup the websocket messages, it always 2 and 3, no other messages like actuators data or connection data send to the browser. So the led on/off is not change.
I try to modify the source code of counterfit like following, then it works.
@socketio.event
def set_and_send_connected(connected:bool = True) -> None:
global is_connected
is_connected = connected
emit('device_connect', {'connected' : is_connected}, namespace='/', broadcast=True)
I am not familiar with websocket, I don't know why, but I hope this can help other guys.
Hi guys, I found the code in lesson 3(senors-and-actuators) not work in my browser.
I tried both in win10 and macOS, and both old version or new version of counterfit.
The situation is when you open your chrome dev tools and lookup the websocket messages, it always
2and3, no other messages like actuators data or connection data send to the browser. So the led on/off is not change.I try to modify the source code of counterfit like following, then it works.
I am not familiar with websocket, I don't know why, but I hope this can help other guys.