Skip to content

Revamp WebSocket API #1393

Closed
Closed
@slandelle

Description

@slandelle

Motivation:

Current WebSocket API has many limitations:

  1. It's not possible to be notified of received fragmented frames, they are always aggregated
  2. It’s not possible to specify extension bits when sending a frame
  3. The API for being notified of write completion is cumbersome
  4. There are tons of different interfaces to be notified of the different types of frames
  5. Method names are not aligned between WebSocket and WebSocketListener
  6. There are 2 onClose listeners, the default one doesn't expose the code and reason

Modifications:

  1. Add a new aggregateWebSocketFrameFragments config param, defaulting to true. When false, fragmented frames are not aggregated. Drop WebSocketByteFragmentListener and WebSocketTextFragmentListener and add finalFragment and rsv parameters to WebSocketListener
  2. Provide a complete set of send methods on WebSocket supporting rsv and fragmentation/continuation frame.
  3. Have send methods return the Netty future so users can register listeners
  4. Drop WebSocketTextListener, WebSocketByteListener, WebSocketPingListener and WebSocketPongListener and add default methods on WebSocketListener. Drop DefaultWebSocketListener.
  5. Rename all methods to sendXXXFrame and onXXXFrame
  6. Drop WebSocketCloseCodeReasonListener and change WebSocketListener#onClose to notify with code and reason.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions