@ChannelHandler.Sharable
public class WebSocketLoginHandler
extends io.netty.channel.SimpleChannelInboundHandler<io.netty.handler.codec.http.websocketx.TextWebSocketFrame>
Credentials and lookup Player and GameRoom objects.
It kicks of the session creation process and will then send the
Events.START event object to websocket client.| Modifier and Type | Field and Description |
|---|---|
protected UniqueIDGeneratorService |
idGeneratorService |
private org.codehaus.jackson.map.ObjectMapper |
jackson |
private static org.slf4j.Logger |
LOG |
private LookupService |
lookupService |
protected ReconnectSessionRegistry |
reconnectRegistry |
| Constructor and Description |
|---|
WebSocketLoginHandler() |
| Modifier and Type | Method and Description |
|---|---|
void |
channelRead0(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http.websocketx.TextWebSocketFrame frame) |
protected void |
closeChannelWithLoginFailure(io.netty.channel.Channel channel) |
void |
connectToGameRoom(GameRoom gameRoom,
PlayerSession playerSession,
io.netty.channel.ChannelFuture future) |
protected io.netty.handler.codec.http.websocketx.TextWebSocketFrame |
eventToFrame(byte opcode,
Object payload) |
UniqueIDGeneratorService |
getIdGeneratorService() |
org.codehaus.jackson.map.ObjectMapper |
getJackson() |
LookupService |
getLookupService() |
ReconnectSessionRegistry |
getReconnectRegistry() |
void |
handleGameRoomJoin(Player player,
io.netty.channel.Channel channel,
String refKey) |
void |
handleLogin(Player player,
io.netty.channel.Channel channel) |
protected void |
handleReconnect(PlayerSession playerSession,
io.netty.channel.Channel channel) |
protected void |
handleReJoin(PlayerSession playerSession,
GameRoom gameRoom,
io.netty.channel.Channel channel) |
Player |
lookupPlayer(String username,
String password) |
PlayerSession |
lookupSession(String reconnectKey) |
void |
setIdGeneratorService(UniqueIDGeneratorService idGeneratorService) |
void |
setJackson(org.codehaus.jackson.map.ObjectMapper jackson) |
void |
setLookupService(LookupService lookupService) |
void |
setReconnectRegistry(ReconnectSessionRegistry reconnectRegistry) |
acceptInboundMessage, channelReadchannelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggeredexceptionCaught, handlerAdded, handlerRemovedprivate static final org.slf4j.Logger LOG
private LookupService lookupService
protected ReconnectSessionRegistry reconnectRegistry
protected UniqueIDGeneratorService idGeneratorService
private org.codehaus.jackson.map.ObjectMapper jackson
public void channelRead0(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http.websocketx.TextWebSocketFrame frame)
throws Exception
channelRead0 in class io.netty.channel.SimpleChannelInboundHandler<io.netty.handler.codec.http.websocketx.TextWebSocketFrame>Exceptionpublic PlayerSession lookupSession(String reconnectKey)
protected void handleReconnect(PlayerSession playerSession, io.netty.channel.Channel channel) throws Exception
Exceptionprotected void handleReJoin(PlayerSession playerSession, GameRoom gameRoom, io.netty.channel.Channel channel)
public Player lookupPlayer(String username, String password) throws Exception
Exceptionpublic void handleLogin(Player player, io.netty.channel.Channel channel) throws Exception
Exceptionprotected void closeChannelWithLoginFailure(io.netty.channel.Channel channel)
throws Exception
Exceptionpublic void handleGameRoomJoin(Player player, io.netty.channel.Channel channel, String refKey) throws Exception
Exceptionpublic void connectToGameRoom(GameRoom gameRoom, PlayerSession playerSession, io.netty.channel.ChannelFuture future)
protected io.netty.handler.codec.http.websocketx.TextWebSocketFrame eventToFrame(byte opcode,
Object payload)
throws Exception
Exceptionpublic LookupService getLookupService()
public void setLookupService(LookupService lookupService)
public ReconnectSessionRegistry getReconnectRegistry()
public void setReconnectRegistry(ReconnectSessionRegistry reconnectRegistry)
public UniqueIDGeneratorService getIdGeneratorService()
public void setIdGeneratorService(UniqueIDGeneratorService idGeneratorService)
public org.codehaus.jackson.map.ObjectMapper getJackson()
public void setJackson(org.codehaus.jackson.map.ObjectMapper jackson)
Copyright © 2013. All Rights Reserved.