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

Streaming (websockets) support #275

Open
Olen opened this issue Jan 17, 2022 · 1 comment
Open

Streaming (websockets) support #275

Olen opened this issue Jan 17, 2022 · 1 comment

Comments

@Olen
Copy link
Contributor

Olen commented Jan 17, 2022

Just throwing this out here as a start.

I had a quick look at fixing the websockets (streaming) connection to add keepalives etc.
But now I actually don't think it has worked at all since switching to httpx, as httpx does not have WS support...

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/teslajsonpy/connection.py", line 288, in websocket_connect
    self.websocket = await self.websession.ws_connect(self.websocket_url)
AttributeError: 'AsyncClient' object has no attribute 'ws_connect'

From this line:

I tried to just replace it with webockets.connect. but that seems to not be a drop in replacement, so it needs a bit more massage before it is usable...

There is a potential problem, that the streaming API seems to only support one client at a time:
teslamate-org/teslamate#753 (comment)

So enabling the streaming API here might interfere with the app. Need to think a bit how to handle that...

@alandtse
Copy link
Collaborator

Oh yah, I forgot that the httpx merge would require another websocket library or wait for official support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants