Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capturing navigation controls from web-app and sending to ESP32 #2

Open
Balaji-Ganesh opened this issue Jun 10, 2023 · 2 comments
Open
Assignees
Labels
✨ enhancement New feature or request
Milestone

Comments

@Balaji-Ganesh
Copy link
Owner

  • Capture the navigation controls from the Web-app using the navigation buttons set.
  • Also try adding feature of sending via keyboard keys.
  • Regarding interval... currently go with some less value, later make it dynamic.
@Balaji-Ganesh Balaji-Ganesh self-assigned this Jun 10, 2023
@Balaji-Ganesh Balaji-Ganesh added this to the Manual Mode milestone Jun 10, 2023
@Balaji-Ganesh Balaji-Ganesh added the ✨ enhancement New feature or request label Jun 10, 2023
@Balaji-Ganesh Balaji-Ganesh pinned this issue Jun 17, 2023
@Balaji-Ganesh
Copy link
Owner Author

In middleware, tried using python-socktio (as a client, in async mode). Unable to make a connection.
Check the logs pasted in the file.

@Balaji-Ganesh
Copy link
Owner Author

Used this repo as a reference -> esp32_SocketIO, which as a library used ESP32/8266 socketio-client library.

Experiment lesson

  • In this experiment, when python-socketio is ran on IP 127.0.0.2 it is not connected. (Even tried to connect via mobile, but couldn't)
  • but later when changed the host of python-socket to 0.0.0.0, then got some messages exchange, but with a lot of errors. (This time could able to connect with mobile, with the IP of host)

Logs.. in middleware side..

...............
INFO:     connection closed
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/uvicorn/protocols/websockets/websockets_impl.py", line 254, in run_asgi
    result = await self.app(self.scope, self.asgi_receive, self.asgi_send)
  File "/usr/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
    return await self.app(scope, receive, send)
  File "/usr/lib/python3.10/site-packages/fastapi/applications.py", line 282, in __call__
    await super().__call__(scope, receive, send)
  File "/home/arjuna/.local/lib/python3.10/site-packages/starlette/applications.py", line 122, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/arjuna/.local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 149, in __call__
    await self.app(scope, receive, send)
  File "/home/arjuna/.local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
    raise exc
  File "/home/arjuna/.local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
    await self.app(scope, receive, sender)
  File "/usr/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 20, in __call__
    raise e
  File "/usr/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 17, in __call__
    await self.app(scope, receive, send)
  File "/home/arjuna/.local/lib/python3.10/site-packages/starlette/routing.py", line 718, in __call__
    await route.handle(scope, receive, send)
  File "/home/arjuna/.local/lib/python3.10/site-packages/starlette/routing.py", line 443, in handle
    await self.app(scope, receive, send)
  File "/home/arjuna/.local/lib/python3.10/site-packages/engineio/async_drivers/asgi.py", line 65, in __call__
    await self.not_found(receive, send)
  File "/home/arjuna/.local/lib/python3.10/site-packages/engineio/async_drivers/asgi.py", line 108, in not_found
    await send({'type': 'http.response.start',
  File "/home/arjuna/.local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 65, in sender
    await send(message)
  File "/usr/lib/python3.10/site-packages/uvicorn/protocols/websockets/websockets_impl.py", line 317, in asgi_send
    raise RuntimeError(msg % message_type)
RuntimeError: Expected ASGI message 'websocket.accept' or 'websocket.close', but got 'http.response.start'.

INFO:     connection open
ERROR:    closing handshake failed
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/websockets/legacy/protocol.py", line 959, in transfer_data
    message = await self.read_message()
  File "/usr/lib/python3.10/site-packages/websockets/legacy/protocol.py", line 1029, in read_message
    frame = await self.read_data_frame(max_size=self.max_size)
  File "/usr/lib/python3.10/site-packages/websockets/legacy/protocol.py", line 1104, in read_data_frame
    frame = await self.read_frame(max_size)
  File "/usr/lib/python3.10/site-packages/websockets/legacy/protocol.py", line 1161, in read_frame
    frame = await Frame.read(
  File "/usr/lib/python3.10/site-packages/websockets/legacy/framing.py", line 68, in read
    data = await reader(2)
  File "/usr/lib/python3.10/asyncio/streams.py", line 705, in readexactly
    raise exceptions.IncompleteReadError(incomplete, n)
asyncio.exceptions.IncompleteReadError: 0 bytes read on a total of 2 expected bytes

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/websockets/legacy/server.py", line 248, in handler
    await self.close()
  File "/usr/lib/python3.10/site-packages/websockets/legacy/protocol.py", line 766, in close
    await self.write_close_frame(Close(code, reason))
  File "/usr/lib/python3.10/site-packages/websockets/legacy/protocol.py", line 1232, in write_close_frame
    await self.write_frame(True, OP_CLOSE, data, _state=State.CLOSING)
  File "/usr/lib/python3.10/site-packages/websockets/legacy/protocol.py", line 1205, in write_frame
    await self.drain()
  File "/usr/lib/python3.10/site-packages/websockets/legacy/protocol.py", line 1194, in drain
    await self.ensure_open()
  File "/usr/lib/python3.10/site-packages/websockets/legacy/protocol.py", line 935, in ensure_open
    raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedError: sent 1000 (OK); no close frame received
..............

Log of ESP32

...........
[SIoC] Disconnected!
[SIoC] add packet 42["status",Hello from esp32!]
[SIoC] add packet 42["status",Hel��2ɽ� esp32!]
[SIoC] Disconnected!
[SIoC] add packet 42["status",Hello from esp32!]
[SIoC] Disconnected!
[SIoC] add packet 42["status",Hello from esp32!]
[SIoC] add packet 42["status",Hello fro+*�32!]
[SIoC] Disconnected!
...........

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant