Package com.smartfoxserver.v2.extensions
Class BaseServerEventHandler
- java.lang.Object
-
- com.smartfoxserver.v2.extensions.BaseServerEventHandler
-
- All Implemented Interfaces:
IServerEventHandler
public abstract class BaseServerEventHandler extends java.lang.Object implements IServerEventHandler
-
-
Constructor Summary
Constructors Constructor Description BaseServerEventHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ISFSApigetApi()Get a reference to the main server side APIprotected org.slf4j.LoggergetLogger()Obtain a direct reference to the Extension's loggerSFSExtensiongetParentExtension()Obtain a reference to the parent extension.protected voidsend(java.lang.String cmdName, ISFSObject params, User recipient)Send a response back to a Userprotected voidsend(java.lang.String cmdName, ISFSObject params, User recipient, boolean useUDP)Send a response back to a Userprotected voidsend(java.lang.String cmdName, ISFSObject params, java.util.List<User> recipients)Broadcast a response back to multiple Usersprotected voidsend(java.lang.String cmdName, ISFSObject params, java.util.List<User> recipients, boolean useUDP)Broadcast a response back to multiple UsersvoidsetParentExtension(SFSExtension ext)protected voidtrace(ExtensionLogLevel level, java.lang.Object... args)Trace a message to the console and log files using the specified logging levelprotected voidtrace(java.lang.Object... args)Traces a message to the console and log files using the Logger INFO level-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.smartfoxserver.v2.extensions.IServerEventHandler
handleServerEvent
-
-
-
-
Method Detail
-
getParentExtension
public SFSExtension getParentExtension()
Obtain a reference to the parent extension.- Specified by:
getParentExtensionin interfaceIServerEventHandler- Returns:
- a reference to the parent extension
-
setParentExtension
public void setParentExtension(SFSExtension ext)
- Specified by:
setParentExtensionin interfaceIServerEventHandler
-
getApi
protected ISFSApi getApi()
Get a reference to the main server side API- Returns:
- the server side API object
-
send
protected void send(java.lang.String cmdName, ISFSObject params, User recipient)Send a response back to a User- Parameters:
cmdName- name of the "command" (or action id)params- the parametersrecipient- the recipient User
-
send
protected void send(java.lang.String cmdName, ISFSObject params, java.util.List<User> recipients)Broadcast a response back to multiple Users- Parameters:
cmdName- name of the "command" (or action id)params- the parametersrecipients- a list of recipients
-
send
protected void send(java.lang.String cmdName, ISFSObject params, User recipient, boolean useUDP)Send a response back to a User- Parameters:
cmdName- name of the "command" (or action id)params- the parametersrecipient- the recipient UseruseUDP- if true the message will be sent as an UDP packet (default == TCP)
-
send
protected void send(java.lang.String cmdName, ISFSObject params, java.util.List<User> recipients, boolean useUDP)Broadcast a response back to multiple Users- Parameters:
cmdName- name of the "command" (or action id)params- the parametersrecipients- a list of recipientsuseUDP- if true the message will be sent as an UDP packet (default == TCP)
-
trace
protected void trace(java.lang.Object... args)
Traces a message to the console and log files using the Logger INFO level- Parameters:
args- any number of strings/object to trace
-
trace
protected void trace(ExtensionLogLevel level, java.lang.Object... args)
Trace a message to the console and log files using the specified logging level- Parameters:
level- the logging levelargs- any number of object to trace
-
getLogger
protected org.slf4j.Logger getLogger()
Obtain a direct reference to the Extension's logger- Returns:
- the logger object.
-
-