-
Notifications
You must be signed in to change notification settings - Fork 84
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
Support message coalescing #306
Conversation
That yarn add didn't work. Not sure how to actually test this |
|
I think this change is great! I wonder how many race conditions we're going to discover. |
Co-authored-by: Paulus Schoutsen <[email protected]>
I've got to be doing something dumb but I can't figure this one out
|
Hm, you can just do this I guess:
And then it's basically an editable install. Restart webpack. |
Seems to have worked. Now I think I have a good test setup 👍 Thanks |
Well spoke too soon
|
I'm going to do |
that works. |
everything works and the latency problem from the connection overhead just disappeared with this change |
Testing https://github.com/bdraco/scaletest and I get one message for the event storms it creates Makes a big difference on performance |
I changed scaletest to do 1000 sensors instead and it no longer overwhelms the system |
And my browser is sitting at 1% cpu instead of maxing out |
Still high cpu with firefox, but much better |
We need to add an opt-in message somewhere. Maybe as part of the auth phase ? |
Ah snap, we also need it to be backwards compatible. So can't do auth phase. |
diff --git a/lib/messages.ts b/lib/messages.ts
index 57258c1..fd655e4 100644
--- a/lib/messages.ts
+++ b/lib/messages.ts
@@ -4,6 +4,7 @@ export function auth(accessToken: string) {
return {
type: "auth",
access_token: accessToken,
+ features: ["coalesce_messages"],
};
}
I was thinking something like this but it blows up auth |
For testing I disabled the dev repo in And I get pages of
|
We should limit sending supported features based on the HA version that we get back. We can access the version string on the socket. https://github.com/home-assistant/home-assistant-js-websocket/blob/master/lib/socket.ts#L20 |
Otherwise people get warnings in their logs on older HA versions. |
oops missed that. |
Co-authored-by: Paulus Schoutsen <[email protected]>
Retesting looks good 👍 |
Not sure if there is a standard enforcement, but you're using snake case where the existing code base is using camel case. |
That's what happens when you write more python 😄 Adjusted |
yarn link
in this folder and thenyarn link home-assistant-js-websocket