Class WebsocketSpec.Builder<SPEC extends WebsocketSpec.Builder<SPEC>>

java.lang.Object
reactor.netty.http.websocket.WebsocketSpec.Builder<SPEC>
All Implemented Interfaces:
Supplier<SPEC>
Direct Known Subclasses:
WebsocketClientSpec.Builder, WebsocketServerSpec.Builder
Enclosing interface:
WebsocketSpec

public static class WebsocketSpec.Builder<SPEC extends WebsocketSpec.Builder<SPEC>> extends Object implements Supplier<SPEC>
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final SPEC
    compress(boolean compress)
    Sets flag whether the websocket compression extension is enabled if the client request presents websocket extensions headers.
    get()
     
    final SPEC
    handlePing(boolean handlePing)
    Sets flag whether to proxy websocket ping frames or respond to them.
    final SPEC
    maxFramePayloadLength(int maxFramePayloadLength)
    Sets a custom maximum allowable frame payload length.
    final SPEC
    protocols(String protocols)
    Sets sub-protocol to use in websocket handshake signature.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Builder

      protected Builder()
  • Method Details

    • protocols

      public final SPEC protocols(String protocols)
      Sets sub-protocol to use in websocket handshake signature. Null by default.
      Parameters:
      protocols - sub-protocol
      Returns:
      this
      Throws:
      NullPointerException - if protocols is null
    • maxFramePayloadLength

      public final SPEC maxFramePayloadLength(int maxFramePayloadLength)
      Sets a custom maximum allowable frame payload length. 65536 by default.

      Note: When a websocket compression extension is enabled, this setting is applied on the compressed data.

      Parameters:
      maxFramePayloadLength - maximum allowable frame payload length
      Returns:
      this
      Throws:
      IllegalArgumentException - if maxFramePayloadLength is negative
    • handlePing

      public final SPEC handlePing(boolean handlePing)
      Sets flag whether to proxy websocket ping frames or respond to them. False by default.
      Parameters:
      handlePing - whether to proxy websocket ping frames or respond to them
      Returns:
      this
    • compress

      public final SPEC compress(boolean compress)
      Sets flag whether the websocket compression extension is enabled if the client request presents websocket extensions headers. By default, compression is disabled.
      Parameters:
      compress - whether the websocket compression extension is enabled if the client request presents websocket extensions headers.
      Returns:
      this
    • get

      public SPEC get()
      Specified by:
      get in interface Supplier<SPEC extends WebsocketSpec.Builder<SPEC>>