Class MultiplexedWebSocketServerStream


public class MultiplexedWebSocketServerStream extends AbstractWebSocketServerStream
Each instance of this type represents a single active websocket, which can allow several concurrent/overlapping gRPC streams. This is in contrast to the WebSocketServerStream type, which supports one websocket per gRPC stream.

To achieve this, each grpc message starts with a 32 bit integer indicating the ID of the stream. If the MSB of that int is 1, then the request must be closed by this message, and that MSB is set to zero to read the ID of the stream. On the initial request, an extra header is sent from the client, indicating the path to the service method. Technically, this makes it possible for a grpc message to split across several websocket frames, but at this time each grpc message is exactly one websocket frame.
  • Field Details


      public static final String GRACEFUL_CLOSE
    • PATH

      public static final io.grpc.Metadata.Key<String> PATH
      Custom metadata to hold the path requested by the incoming stream

      public static final String GRPC_WEBSOCKETS_MULTIPLEX_PROTOCOL
      See Also:
  • Constructor Details

    • MultiplexedWebSocketServerStream

      public MultiplexedWebSocketServerStream(io.grpc.internal.ServerTransportListener transportListener, List<? extends io.grpc.ServerStreamTracer.Factory> streamTracerFactories, int maxInboundMessageSize, io.grpc.Attributes attributes)
  • Method Details