Skip to content

Draft_75 long messages (+suggested patch) #59

@lassic

Description

@lassic

Hi,
I'm using this library on Android to communicate with an (old?) Draft_75 server.
I found that long messages from the server were not assembled correctly on the client side.
I'm not a big expert on web sockets, so I'm not even sure Draft_75 is supposed to handle this on the client or how.
Could be a crude hack, but what I ended up doing to get it working was:

// Changes to Draft_75 class

  1. add a boolean field:
    private boolean appending = false;
  2. inside if (readingState) { ... }
    curframe.setOptcode ( Opcode.CONTINIOUS ); // instead of TEXT
    this.appending = true;
  3. when closing the read on END_OF_FRAME:
    curframe.setOptcode ( this.appending ? Opcode.CONTINIOUS : Opcode.TEXT );
    this.appending = false;

This makes WebSocket enter the Opcode.CONTINIOUS state when reading such frames,
and when the fin is marked on the last frame part, the message is emitted.

Sorry if this is way off or something, hopefully it will help somehow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions