Skip to content

WebSocket: enable permessage-deflate to communication#2616

Merged
sfeilmeier merged 1 commit intoOpenEMS:developfrom
girasolenergy:feature/enable-permessagedeflate-to-websocket
Apr 12, 2024
Merged

WebSocket: enable permessage-deflate to communication#2616
sfeilmeier merged 1 commit intoOpenEMS:developfrom
girasolenergy:feature/enable-permessagedeflate-to-websocket

Conversation

@miettal
Copy link
Copy Markdown
Contributor

@miettal miettal commented Apr 12, 2024

@github-actions
Copy link
Copy Markdown

Code Coverage

@miettal
Copy link
Copy Markdown
Contributor Author

miettal commented Apr 12, 2024

320791082-1d4b9e0c-4323-447e-a4be-786df59a14f1320791138-3ef3b45f-8d81-4914-a08b-f764a9cc241d

@Sn0w3y
Copy link
Copy Markdown
Collaborator

Sn0w3y commented Apr 12, 2024

WOW ! @sfeilmeier this improves Loading Speeds a lot ! Channels get updated more frequently etc.

@sfeilmeier
Copy link
Copy Markdown
Contributor

Great! Thanks for the contribution, I did not know about this.

Just to be sure, without testing it myself: Is this feature backwards compatible, i.e. do the following scenarios work?

  • Client without permessage-deflate -> connecting to Server with permessage-deflate
  • Client with permessage-deflate -> connecting to Server with permessage-deflate
  • Client with permessage-deflate -> connecting to Server without permessage-deflate

@Sn0w3y
Copy link
Copy Markdown
Collaborator

Sn0w3y commented Apr 12, 2024

Interestingly I also asked myself this question :D

I updated my Backend and ONE Device and vice-versa.
Outcome:

  • Client without permessage-deflate -> connecting to Server with permessage-deflate

Can confirm

  • Client with permessage-deflate -> connecting to Server with permessage-deflate

Can confirm

  • Client with permessage-deflate -> connecting to Server without permessage-deflate

Can confirm

@sfeilmeier
Copy link
Copy Markdown
Contributor

Thank you @Sn0w3y!

@sfeilmeier sfeilmeier changed the title feat: enable permessage-deflate to websocket communication WebSocket: enable permessage-deflate to communication Apr 12, 2024
@sfeilmeier sfeilmeier merged commit 76f519c into OpenEMS:develop Apr 12, 2024
fanass-dev pushed a commit to fanass-dev/openems that referenced this pull request May 6, 2024
@Sn0w3y
Copy link
Copy Markdown
Collaborator

Sn0w3y commented May 25, 2024

@miettal Sometimes it comes to:

May 25 19:24:57 java[25091]: 2024-05-25T19:24:57,973 [orker-80] ERROR [g.java_websocket.WebSocketImpl] Closing due to invalid data in frame May 25 19:24:57 java[25091]: org.java_websocket.exceptions.InvalidDataException: invalid distance too far back May 25 19:24:57 java[25091]: at org.java_websocket.extensions.permessage_deflate.PerMessageDeflateExtension.decodeFrame(PerMessageDeflateExtension.java:181) ~[?:?] May 25 19:24:57 java[25091]: at org.java_websocket.drafts.Draft_6455.translateSingleFrame(Draft_6455.java:589) ~[?:?] May 25 19:24:57 java[25091]: at org.java_websocket.drafts.Draft_6455.translateFrame(Draft_6455.java:744) ~[?:?] May 25 19:24:57 java[25091]: at org.java_websocket.WebSocketImpl.decodeFrames(WebSocketImpl.java:399) ~[?:?] May 25 19:24:57 java[25091]: at org.java_websocket.WebSocketImpl.decode(WebSocketImpl.java:234) ~[?:?] May 25 19:24:57 java[25091]: at org.java_websocket.server.WebSocketServer$WebSocketWorker.doDecode(WebSocketServer.java:1114) ~[?:?] May 25 19:24:57 java[25091]: at org.java_websocket.server.WebSocketServer$WebSocketWorker.run(WebSocketServer.java:1086) ~[?:?] May 25 19:24:57 java[25091]: 2024-05-25T19:24:57,977 [socket-7] WARN [.backend.edgewebsocket.OnError] [Edge.Websocket] Websocket error. InvalidDataException: invalid distance too far back May 25 19:24:57 java[25091]: org.java_websocket.exceptions.InvalidDataException: invalid distance too far back May 25 19:24:57 java[25091]: at org.java_websocket.extensions.permessage_deflate.PerMessageDeflateExtension.decodeFrame(PerMessageDeflateExtension.java:181) May 25 19:24:57 java[25091]: at org.java_websocket.drafts.Draft_6455.translateSingleFrame(Draft_6455.java:589) May 25 19:24:57 java[25091]: at org.java_websocket.drafts.Draft_6455.translateFrame(Draft_6455.java:744) May 25 19:24:57 java[25091]: at org.java_websocket.WebSocketImpl.decodeFrames(WebSocketImpl.java:399) May 25 19:24:57 java[25091]: at org.java_websocket.WebSocketImpl.decode(WebSocketImpl.java:234) May 25 19:24:57 java[25091]: at org.java_websocket.server.WebSocketServer$WebSocketWorker.doDecode(WebSocketServer.java:1114) May 25 19:24:57 java[25091]: at org.java_websocket.server.WebSocketServer$WebSocketWorker.run(WebSocketServer.java:1086) May 25 19:24:57 java[25091]: 2024-05-25T19:24:57,990 [socket-8] INFO [.backend.edgewebsocket.OnClose] [Edge.Websocket] Disconnected. Code [1008] Reason [invalid distance too far back]

How could we solve this?
I have the thought that this happens because the Device is in a "Bad Connection" State via WLAN. Could this be ?

@miettal
Copy link
Copy Markdown
Contributor Author

miettal commented May 27, 2024

I'm not expert of java and websocket, but I guess the possibility are ...

  • TooTallNate/Java-WebSocket has de-initialization process bug.
  • TooTallNate/Java-WebSocket has decoding(protocol implementation) bug
  • client side encoding(protocol implementation) bug

if the problem happens in specific devices, Could you share it?

@Sn0w3y
Copy link
Copy Markdown
Collaborator

Sn0w3y commented May 27, 2024

if the problem happens in specific devices, Could you share it?

BeagleBone Black - last recent OpenEMS Version - but i do not think it is replicable as i told you the WiFi Connection is very low at the place where the device is Conneted to :)

@miettal
Copy link
Copy Markdown
Contributor Author

miettal commented May 31, 2024

hmmm, Thanks information. I also try/investigate to this kind log my server.

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

Successfully merging this pull request may close these issues.

3 participants