Class NettyServerWebSocketHandler
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.server.netty.websocket.NettyServerWebSocketHandler
- All Implemented Interfaces:
io.netty.channel.ChannelHandler
,io.netty.channel.ChannelInboundHandler
A handler for
WebSocketFrame
instances.- Since:
- 1.0
- Author:
- graemerocher
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The id of the handler used when adding it to the Netty pipeline.Fields inherited from class io.micronaut.http.netty.websocket.AbstractNettyWebSocketHandler
conversionService, LOG, mediaTypeCodecRegistry, messageHandler, originatingRequest, pongHandler, subProtocol, uriVariables, webSocketBean, webSocketBinder, webSocketSessionRepository, webSocketVersion
-
Method Summary
Modifier and TypeMethodDescriptionboolean
protected NettyWebSocketSession
createWebSocketSession
(io.netty.channel.ChannelHandlerContext ctx) Subclasses should implement to create the actualNettyWebSocketSession
.Argument<?>
Argument<?>
void
handlerRemoved
(io.netty.channel.ChannelHandlerContext ctx) protected Publisher<?>
instrumentPublisher
(io.netty.channel.ChannelHandlerContext ctx, Object result) Subclasses can override to customize publishers returned from message handlers.protected Object
invokeExecutable
(BoundExecutable boundExecutable, MethodExecutionHandle<?, ?> messageHandler) Invokes the given executable.protected void
messageHandled
(io.netty.channel.ChannelHandlerContext ctx, Object message) Method called once a message has been handled by the handler.void
userEventTriggered
(io.netty.channel.ChannelHandlerContext ctx, Object evt) Methods inherited from class io.micronaut.http.netty.websocket.AbstractNettyWebSocketHandler
callOpenMethod, channelRead0, exceptionCaught, forwardErrorToUser, handleCloseReason, handleWebSocketFrame, writeCloseFrameAndTerminate
Methods inherited from class io.netty.channel.SimpleChannelInboundHandler
channelRead
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, isSharable
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.netty.channel.ChannelHandler
handlerAdded
-
Field Details
-
ID
The id of the handler used when adding it to the Netty pipeline.- See Also:
-
-
Method Details
-
getSession
- Specified by:
getSession
in classAbstractNettyWebSocketHandler
- Returns:
- The session
-
getBodyArgument
- Specified by:
getBodyArgument
in classAbstractNettyWebSocketHandler
- Returns:
- The body argument for the message handler
-
getPongArgument
- Specified by:
getPongArgument
in classAbstractNettyWebSocketHandler
- Returns:
- The pong argument for the pong handler
-
userEventTriggered
public void userEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object evt) throws Exception - Specified by:
userEventTriggered
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
userEventTriggered
in classio.netty.channel.ChannelInboundHandlerAdapter
- Throws:
Exception
-
acceptInboundMessage
- Overrides:
acceptInboundMessage
in classio.netty.channel.SimpleChannelInboundHandler<Object>
-
createWebSocketSession
Description copied from class:AbstractNettyWebSocketHandler
Subclasses should implement to create the actualNettyWebSocketSession
.- Specified by:
createWebSocketSession
in classAbstractNettyWebSocketHandler
- Parameters:
ctx
- The context- Returns:
- The session
-
instrumentPublisher
protected Publisher<?> instrumentPublisher(io.netty.channel.ChannelHandlerContext ctx, Object result) Description copied from class:AbstractNettyWebSocketHandler
Subclasses can override to customize publishers returned from message handlers.- Overrides:
instrumentPublisher
in classAbstractNettyWebSocketHandler
- Parameters:
ctx
- The contextresult
- The result- Returns:
- The flowable
-
invokeExecutable
protected Object invokeExecutable(BoundExecutable boundExecutable, MethodExecutionHandle<?, ?> messageHandler) Description copied from class:AbstractNettyWebSocketHandler
Invokes the given executable.- Overrides:
invokeExecutable
in classAbstractNettyWebSocketHandler
- Parameters:
boundExecutable
- The bound executablemessageHandler
- The message handler- Returns:
- The result
-
messageHandled
Description copied from class:AbstractNettyWebSocketHandler
Method called once a message has been handled by the handler.- Overrides:
messageHandled
in classAbstractNettyWebSocketHandler
- Parameters:
ctx
- The channel handler contextmessage
- The message that was handled
-
handlerRemoved
- Specified by:
handlerRemoved
in interfaceio.netty.channel.ChannelHandler
- Overrides:
handlerRemoved
in classAbstractNettyWebSocketHandler
- Throws:
Exception
-