Skip to content

[Android & Node.js Server] Problem using PerMessageDeflateExtension with custom ping/pong messages ?  #1164

Description

@SaraHan774

Hi, I have a question about using PerMessageDeflateExtension.

E/SessionManager: ◖[Session] WebSocket error #Network	⚑[SessionManager$listenToEvents$6.accept:358]
E/SessionManager: ◖ org.java_websocket.exceptions.InvalidFrameException: RSV1 bit must be set for DataFrames.
E/SessionManager: ◖	at org.java_websocket.extensions.permessage_deflate.PerMessageDeflateExtension.isFrameValid(PerMessageDeflateExtension.java:321)
E/SessionManager: ◖	at org.java_websocket.drafts.Draft_6455.translateSingleFrame(Draft_6455.java:565)
E/SessionManager: ◖	at org.java_websocket.drafts.Draft_6455.translateFrame(Draft_6455.java:739)
E/SessionManager: ◖	at org.java_websocket.WebSocketImpl.decodeFrames(WebSocketImpl.java:398)
E/SessionManager: ◖	at org.java_websocket.WebSocketImpl.decode(WebSocketImpl.java:233)
E/SessionManager: ◖	at org.java_websocket.client.WebSocketClient.run(WebSocketClient.java:516)
E/SessionManager: ◖	at java.lang.Thread.run(Thread.java:923)
E/SessionManager: ◖ 

I ran into above error log, so I made a break point like below.

image

image

If you see the log, the payload contains our custom ping message which is being transferred in TextFrame. I would like to know if this kind of custom ping/pong message could interfere with using PerMessageDeflateExtensions properly. (I checked the RFC 6455 document and read that Ping/Pong Frames have different opcodes)

Also, I couldn't understand the purpose of the below lines.

    public void isFrameValid(Framedata inputFrame) throws InvalidDataException {
        if((inputFrame instanceof TextFrame || inputFrame instanceof BinaryFrame) && !inputFrame.isRSV1())
            throw new InvalidFrameException("RSV1 bit must be set for DataFrames.");

Does this mean that all TextFrame & BinaryFrame data should have isRSV1() set to true ? If so, how does it handle situations when server compresses data selectively?

Best Regards,
Sara.


  • Java-WebSocket Version 1.5.2
  • Java 1.8
  • Node.js uses ws websocket library

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions