Class NettyWebSocketClientHandler<T>

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.SimpleChannelInboundHandler<Object>
io.micronaut.http.netty.websocket.AbstractNettyWebSocketHandler
io.micronaut.http.client.netty.websocket.NettyWebSocketClientHandler<T>
Type Parameters:
T - The type emitted.
All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler

@Internal public class NettyWebSocketClientHandler<T> extends AbstractNettyWebSocketHandler
Handler for WebSocket clients.
Since:
1.0
Author:
graemerocher
  • Constructor Details

    • NettyWebSocketClientHandler

      public NettyWebSocketClientHandler(MutableHttpRequest<?> request, WebSocketBean<T> webSocketBean, io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker handshaker, RequestBinderRegistry requestBinderRegistry, MediaTypeCodecRegistry mediaTypeCodecRegistry, MessageBodyHandlerRegistry messageBodyHandlerRegistry, ConversionService conversionService)
      Default constructor.
      Parameters:
      request - The originating request that created the WebSocket.
      webSocketBean - The WebSocket client bean.
      handshaker - The handshaker
      requestBinderRegistry - The request binder registry
      mediaTypeCodecRegistry - The media type codec registry
      messageBodyHandlerRegistry - The handler registry
      conversionService - The conversionService
  • Method Details

    • userEventTriggered

      public void userEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object evt) throws Exception
      Specified by:
      userEventTriggered in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      userEventTriggered in class io.netty.channel.ChannelInboundHandlerAdapter
      Throws:
      Exception
    • getBodyArgument

      public Argument<?> getBodyArgument()
      Specified by:
      getBodyArgument in class AbstractNettyWebSocketHandler
      Returns:
      The body argument for the message handler
    • getPongArgument

      public Argument<?> getPongArgument()
      Specified by:
      getPongArgument in class AbstractNettyWebSocketHandler
      Returns:
      The pong argument for the pong handler
    • getSession

      public NettyWebSocketSession getSession()
      Specified by:
      getSession in class AbstractNettyWebSocketHandler
      Returns:
      The session
    • channelActive

      public void channelActive(io.netty.channel.ChannelHandlerContext ctx)
      Specified by:
      channelActive in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelActive in class io.netty.channel.ChannelInboundHandlerAdapter
    • channelRead0

      protected void channelRead0(io.netty.channel.ChannelHandlerContext ctx, Object msg)
      Overrides:
      channelRead0 in class AbstractNettyWebSocketHandler
    • createWebSocketSession

      protected NettyWebSocketSession createWebSocketSession(io.netty.channel.ChannelHandlerContext ctx)
      Description copied from class: AbstractNettyWebSocketHandler
      Subclasses should implement to create the actual NettyWebSocketSession.
      Specified by:
      createWebSocketSession in class AbstractNettyWebSocketHandler
      Parameters:
      ctx - The context
      Returns:
      The session
    • exceptionCaught

      public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause)
      Specified by:
      exceptionCaught in interface io.netty.channel.ChannelHandler
      Specified by:
      exceptionCaught in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      exceptionCaught in class AbstractNettyWebSocketHandler
    • getHandshakeCompletedMono

      public final reactor.core.publisher.Mono<T> getHandshakeCompletedMono()
    • handleCloseReason

      protected void handleCloseReason(io.netty.channel.ChannelHandlerContext ctx, CloseReason cr, boolean writeCloseReason)
      Description copied from class: AbstractNettyWebSocketHandler
      Used to close the session with a given reason.
      Overrides:
      handleCloseReason in class AbstractNettyWebSocketHandler
      Parameters:
      ctx - The context
      cr - The reason
      writeCloseReason - Whether to allow writing the close reason to the remote