public class WebSocketProtocol extends AbstractNettyProtocol
Event
objects and sent to the Session
. The outgoing messages will be
converted from Events to JSon string representation using Gson
library.Modifier and Type | Field and Description |
---|---|
private static org.slf4j.Logger |
LOG |
private TextWebsocketDecoder |
textWebsocketDecoder
Used to decode incoming JSon string objects to
Event objects. |
private TextWebsocketEncoder |
textWebsocketEncoder
Used to encode the outgoing Event objects to JSon string representation.
|
IDLE_CHECK_HANDLER, IDLE_STATE_CHECK_HANDLER
Constructor and Description |
---|
WebSocketProtocol() |
Modifier and Type | Method and Description |
---|---|
void |
applyProtocol(PlayerSession playerSession)
The main method of this interface.
|
void |
applyProtocol(PlayerSession playerSession,
boolean clearExistingProtocolHandlers)
Specifically overriden so that the pipeline is not cleared.
|
TextWebsocketDecoder |
getTextWebsocketDecoder() |
TextWebsocketEncoder |
getTextWebsocketEncoder() |
void |
setTextWebsocketDecoder(TextWebsocketDecoder textWebsocketDecoder) |
void |
setTextWebsocketEncoder(TextWebsocketEncoder textWebsocketEncoder) |
createLengthBasedFrameDecoder, getProtocolName
private static final org.slf4j.Logger LOG
private TextWebsocketDecoder textWebsocketDecoder
Event
objects.private TextWebsocketEncoder textWebsocketEncoder
public void applyProtocol(PlayerSession playerSession, boolean clearExistingProtocolHandlers)
applyProtocol
in interface Protocol
applyProtocol
in class AbstractNettyProtocol
clearExistingProtocolHandlers
- Clears the pipeline of existing protocol handlers if set to
true.public void applyProtocol(PlayerSession playerSession)
Protocol
LoginHandler
or whichever previous
handler was handling the message has cleared up the
ChannelPipeline
object.playerSession
- The user session for which the protocol handlers need to be
set.public TextWebsocketEncoder getTextWebsocketEncoder()
public void setTextWebsocketEncoder(TextWebsocketEncoder textWebsocketEncoder)
public TextWebsocketDecoder getTextWebsocketDecoder()
public void setTextWebsocketDecoder(TextWebsocketDecoder textWebsocketDecoder)
Copyright © 2013. All Rights Reserved.