|
Platform SDK Java 8.5 API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.genesyslab.platform.commons.protocol.AbstractChannel
com.genesyslab.platform.commons.protocol.DuplexChannel
com.genesyslab.platform.commons.protocol.ClientChannel
com.genesyslab.platform.webmedia.protocol.WebmediaChannel
com.genesyslab.platform.webmedia.protocol.OptionalRegistrationChannel
com.genesyslab.platform.webmedia.protocol.FlexChatProtocol
@ProtocolDescription.Tag(sdkName="WebMedia", protocolName="FlexChat") public class FlexChatProtocol
By default, channel has enabled AutoRegister mode. If channel going to be used for more than one chat server client, you should disable AutoRegister mode and explicitly login every client:
flexChat.setAutoRegister(false);
flexChat.open();
...
Message response = flexChat.request(RequestLogin.create(nickName, timeZone, userData));
if(response instanceof EventStatus) {
EventStatus status = (EventStatus)response;
String userId = status.getUserId();
String secureKey = status.getSecureKey();
}
...
Explicitly specify userId/secureKey in further interactions:
Message response = flexChat.request(RequestJoin.create(userId, secureKey, ...));
Protocol object can also auto store userId/secureKey and automatically update Request fields,
but this have sense only for single chat server client.
When AutoRegister mode enabled:
These UserId and SecureKey properties will be set automatically in each user request by channel, if they are not set manually.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.genesyslab.platform.commons.protocol.ClientChannel |
---|
ClientChannel.BasicClientHandshakeStep, ClientChannel.ClientHandshakeStep, ClientChannel.RegistrationHandler, ClientChannel.SimpleRegistrationHandler |
Nested classes/interfaces inherited from class com.genesyslab.platform.commons.protocol.AbstractChannel |
---|
AbstractChannel.AsyncErrorNotifier |
Field Summary | |
---|---|
static ProtocolDescription |
PROTOCOL_DESCRIPTION
|
Fields inherited from class com.genesyslab.platform.webmedia.protocol.WebmediaChannel |
---|
OPTION_NAME_ILLEGAL_UNICODE_CHARS_REPLACEMENT, OPTION_NAME_REPLACE_ILLEGAL_UNICODE_CHARS, OPTION_NAME_TARGET_XML_VERSION |
Fields inherited from class com.genesyslab.platform.commons.protocol.DuplexChannel |
---|
messageFilter |
Fields inherited from interface com.genesyslab.platform.commons.protocol.Receiver |
---|
DEF_INPUT_SIZE |
Fields inherited from interface com.genesyslab.platform.commons.protocol.Channel |
---|
DEFAULT_TIMEOUT, INFINITE_TIMEOUT |
Constructor Summary | |
---|---|
FlexChatProtocol()
Creates instance of FlexChatProtocol. |
|
FlexChatProtocol(Endpoint endpoint)
Creates instance of FlexChatProtocol. |
|
FlexChatProtocol(Endpoint endpoint,
long timeout)
Creates instance of FlexChatProtocol. |
|
FlexChatProtocol(Endpoint endpoint,
ReferenceBuilder refBuilder,
long timeout)
Creates instance of FlexChatProtocol. |
Method Summary | |
---|---|
protected com.genesyslab.platform.commons.connection.impl.xml.ProtocolDialect |
getDialect()
|
protected ClientChannel.ClientHandshakeStep |
getHandshakeStart()
This virtual method returns initial handshake step for this channel. |
java.lang.String |
getSecureKey()
Optional, if set with UserId, channel will not send RequestLogin message during opening. |
FlexChatServerContext |
getServerContext()
|
java.lang.Integer |
getTimeZoneOffset()
Optional, timezone offset. |
KeyValueCollection |
getUserData()
Optional, used for user identification in UCS (Universal Contact Server). |
java.lang.String |
getUserId()
Optional, if set with SecureKey, channel will not send RequestLogin message during opening. |
java.lang.String |
getUserNickname()
Optional, but very desirable for login during channel Open. |
boolean |
isAutoRegister()
Returns flag for automatic client registration request on connection open. By default it is enabled, but sometimes it may be required to do some other operations before client registration request, or there is a need to create custom registration request. In this case user may disable automatic registration and later (after the connection opened) send own registration request. |
protected void |
onClose(ConnectionClosedEvent event)
|
protected void |
onOpen()
This method is called when channel is opened and just about to call event handler. |
protected void |
onReceiveMessage(Message message)
Gives to subclass a chance to perform some operations on incoming message arrival before delivering it to connection user code. |
void |
onSend(Message message)
Gives to subclass a chance to modify message before sending it to remote party. |
void |
setAutoRegister(boolean autoRegister)
Sets flag for automatic client registration request on connection open. By default it is enabled, but sometimes it may be required to do some other operations before client registration request, or there is a need to create custom registration request. In this case user may disable automatic registration and later (after the connection opened) send own registration request. |
void |
setSecureKey(java.lang.String secureKey)
Optional, if set with UserId, channel will not send RequestLogin message during opening. |
void |
setTimeZoneOffset(int timeZoneOffset)
Optional, timezone offset. |
void |
setTimeZoneOffset(java.lang.Integer timeZoneOffset)
Optional, timezone offset. |
void |
setUserData(KeyValueCollection userData)
Optional, used for user identification in UCS (Universal Contact Server). |
void |
setUserId(java.lang.String userId)
Optional, if set with SecureKey, channel will not send RequestLogin message during opening. |
void |
setUserNickname(java.lang.String userNickname)
Optional, but very desirable for login during channel Open. |
Methods inherited from class com.genesyslab.platform.webmedia.protocol.WebmediaChannel |
---|
applyConfiguration, createConnection, lookupConnectionParameter |
Methods inherited from class com.genesyslab.platform.commons.protocol.ClientChannel |
---|
beginClose, beginOpen, beginRequest, close, close, closeAsync, closeAsync, disableConnectionOperations, doBeginRequest, doBeginRequest, doRequest, endRequest, endRequest, fireUnsolicitedEvents, getCopyResponse, getInvoker, getOpenTimeoutException, getReferenceBuilder, onUnexpectedHandshakeMessage, open, openAsync, openAsync, request, request, requestAsync, requestAsync, setAddressResolver, setAddressResolverParams, setAddressResolverParams, setCopyResponse, setEndpoint, setHandshakeFinished, setHandshakePhase, setHandshakeUnsolicitedEventsPassLimit, setRegistrationHandler, setState, submitRegMessage, throwOnUnReferenceableRequest |
Methods inherited from class com.genesyslab.platform.commons.protocol.AbstractChannel |
---|
addChannelListener, configure, connectionContext, copyTLSSettings, fireClosed, fireErrorEvent, fireErrorEvent, generateChannelId, getChannelId, getConfiguration, getDefaultInvoker, getEndpoint, getListenerHelper, getState, getStateMods, getTimeout, internal, onSetEndpoint, releaseDefaultInvoker, removeChannelListener, setConfiguration, setInvoker, setServerContext, setState, setTimeout, throwNotClosed, throwNotOpened, throwNotOpenedOnClose, throwNotOpenedOnSend, throwNull, throwNullEndpoint |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.genesyslab.platform.commons.protocol.Protocol |
---|
getProtocolId |
Methods inherited from interface com.genesyslab.platform.commons.protocol.InputChannel |
---|
setMessageHandler |
Methods inherited from interface com.genesyslab.platform.commons.protocol.MessageReceiver |
---|
receive, receive |
Methods inherited from interface com.genesyslab.platform.commons.protocol.Receiver |
---|
clearInput, getInputSize, releaseReceivers, setInputSize |
Methods inherited from interface com.genesyslab.platform.commons.protocol.OutputChannel |
---|
addListener, removeListener, send |
Methods inherited from interface com.genesyslab.platform.commons.protocol.Channel |
---|
close, getTimeout, open, setTimeout |
Methods inherited from interface com.genesyslab.platform.commons.protocol.AsyncChannel |
---|
getState |
Methods inherited from interface com.genesyslab.platform.commons.protocol.ChannelListenerSupport |
---|
addChannelListener, removeChannelListener |
Methods inherited from interface com.genesyslab.platform.commons.protocol.InterceptorSupport |
---|
getInterceptor |
Methods inherited from interface com.genesyslab.platform.commons.protocol.MessageReceiverManagement |
---|
setReceiver |
Methods inherited from interface com.genesyslab.platform.commons.protocol.ReceiverManagement |
---|
resetReceiver |
Methods inherited from interface com.genesyslab.platform.commons.protocol.ConfigurationSupport |
---|
configure, getConfiguration |
Methods inherited from interface com.genesyslab.platform.commons.protocol.EndpointSupport |
---|
getEndpoint |
Methods inherited from interface com.genesyslab.platform.commons.protocol.ProtocolDescriptionSupport |
---|
getProtocolDescription |
Methods inherited from interface com.genesyslab.platform.commons.protocol.AsyncInvokerSupport |
---|
setInvoker |
Methods inherited from interface com.genesyslab.platform.commons.protocol.ConnectionInvokerSupport |
---|
setConnectionInvoker |
Field Detail |
---|
public static final ProtocolDescription PROTOCOL_DESCRIPTION
Constructor Detail |
---|
public FlexChatProtocol(Endpoint endpoint, ReferenceBuilder refBuilder, long timeout)
endpoint
- Parameters of the connection to createtimeout
- Timeout to wait for message (in milliseconds)public FlexChatProtocol(Endpoint endpoint, long timeout)
endpoint
- Parameters of the connection to createtimeout
- Timeout to wait for message (in milliseconds)public FlexChatProtocol(Endpoint endpoint)
endpoint
- Parameters of the connection to createpublic FlexChatProtocol()
Method Detail |
---|
public java.lang.Integer getTimeZoneOffset()
getTimeZoneOffset
in interface FlexChatProtocolHandshakeOptions
public void setTimeZoneOffset(java.lang.Integer timeZoneOffset)
setTimeZoneOffset
in interface FlexChatProtocolHandshakeOptions
timeZoneOffset
- timezone offsetpublic void setTimeZoneOffset(int timeZoneOffset)
setTimeZoneOffset
in interface FlexChatProtocolHandshakeOptions
timeZoneOffset
- timezone offsetpublic KeyValueCollection getUserData()
getUserData
in interface FlexChatProtocolHandshakeOptions
public void setUserData(KeyValueCollection userData)
setUserData
in interface FlexChatProtocolHandshakeOptions
userData
- user datapublic java.lang.String getUserNickname()
getUserNickname
in interface FlexChatProtocolHandshakeOptions
public void setUserNickname(java.lang.String userNickname)
setUserNickname
in interface FlexChatProtocolHandshakeOptions
userNickname
- user nicknamepublic java.lang.String getSecureKey()
getSecureKey
in interface FlexChatProtocolHandshakeOptions
public void setSecureKey(java.lang.String secureKey)
setSecureKey
in interface FlexChatProtocolHandshakeOptions
secureKey
- secure keypublic java.lang.String getUserId()
getUserId
in interface FlexChatProtocolHandshakeOptions
public void setUserId(java.lang.String userId)
setUserId
in interface FlexChatProtocolHandshakeOptions
userId
- user idpublic boolean isAutoRegister()
isAutoRegister
in interface FlexChatProtocolHandshakeOptions
isAutoRegister
in class OptionalRegistrationChannel
setAutoRegister(boolean)
,
RequestLogin
public void setAutoRegister(boolean autoRegister)
setAutoRegister
in interface FlexChatProtocolHandshakeOptions
setAutoRegister
in class OptionalRegistrationChannel
autoRegister
- flag for automatic client registration request allowingRequestLogin
protected void onOpen() throws ProtocolException
DuplexChannel
onOpen
in class OptionalRegistrationChannel
ProtocolException
- if there are problems during
post open operations (e.g. registration)protected void onClose(ConnectionClosedEvent event)
onClose
in class DuplexChannel
public FlexChatServerContext getServerContext()
getServerContext
in class AbstractChannel
public void onSend(Message message) throws ProtocolException
DuplexChannel
onSend
in class ClientChannel
message
- Message to modify
ProtocolException
- In the case of an unrecoverable protocol error. Client applications should not
try to deal with these exceptions, except for logging or displaying to users or technical administrators.
Check the exception cause for more details.protected void onReceiveMessage(Message message)
DuplexChannel
onReceiveMessage
in class ClientChannel
message
- received messageprotected com.genesyslab.platform.commons.connection.impl.xml.ProtocolDialect getDialect()
getDialect
in class WebmediaChannel
protected ClientChannel.ClientHandshakeStep getHandshakeStart()
OptionalRegistrationChannel
getHandshakeStart
in class OptionalRegistrationChannel
|
Platform SDK Java 8.5 API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |