AsyncChannel
, AsyncChannelOperations
, AsyncInvokerSupport
, Channel
, ChannelListenerSupport
, ConfigurationSupport
, ConnectionInvokerSupport
, EndpointSupport
, InputChannel
, InterceptorSupport
, LogMessageFilterSupport
, MessageReceiver
, MessageReceiverManagement
, OutputChannel
, Protocol
, ProtocolDescriptionSupport
, Receiver
, ReceiverManagement
, RequestChannel
, FlexChatProtocolHandshakeOptions
@Tag(sdkName="WebMedia", protocolName="FlexChat") public class FlexChatProtocol extends OptionalRegistrationChannel implements FlexChatProtocolHandshakeOptions
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.
AbstractChannel.AsyncErrorNotifier
ClientChannel.BasicClientHandshakeStep, ClientChannel.ClientHandshakeStep, ClientChannel.RegistrationHandler, ClientChannel.SimpleRegistrationHandler
Modifier and Type | Field | Description |
---|---|---|
static ProtocolDescription |
PROTOCOL_DESCRIPTION |
DEFAULT_TIMEOUT, INFINITE_TIMEOUT
messageFilter
DEF_INPUT_SIZE
OPTION_NAME_ILLEGAL_UNICODE_CHARS_REPLACEMENT, OPTION_NAME_REPLACE_ILLEGAL_UNICODE_CHARS, OPTION_NAME_TARGET_XML_VERSION
Constructor | Description |
---|---|
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.
|
Modifier and Type | Method | Description |
---|---|---|
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.
|
protected static void |
processReceivedMessage(FlexChatProtocolHandshakeOptions protocol,
Message message) |
|
protected static void |
processSendingMessage(FlexChatProtocolHandshakeOptions protocol,
Message message) |
|
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.
|
addChannelListener, configure, connectionContext, copyTLSSettings, fireClosed, fireErrorEvent, fireErrorEvent, generateChannelId, getChannelId, getConfiguration, getDefaultInvoker, getEndpoint, getListenerHelper, getState, getStateMods, getTimeout, getTimer, internal, onSetEndpoint, releaseDefaultInvoker, removeChannelListener, setConfiguration, setInvoker, setServerContext, setState, setTimeout, throwNotClosed, throwNotOpened, throwNotOpenedOnClose, throwNotOpenedOnSend, throwNull, throwNullEndpoint
getState
setInvoker
close, getTimeout, open, setTimeout
addChannelListener, removeChannelListener
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
configure, getConfiguration
setConnectionInvoker
addListener, cancelCloseTimeout, cancelOpenTimeout, clearInput, close, closeAsync, createChannelClosedEvent, createConnectionClosedEvent, doBeginClose, doClose, doSend, downgradeConnection, getConnectionClosedCause, getDefaultRestriction, getEnpointPrefixInfo, getInputSize, getInterceptor, getLocalEndPoint, getLocalEndpointInfo, getLogMessageFilter, getProtocolDescription, getProtocolFactory, getProtocolId, getRemoteEndPoint, getTimeoutException, initPackager, isMessageAllowed, notifyWithObject, onFireClosed, onFireErrorEvent, onFireOpened, open, openAsync, openAsync, processClose, processCloseAll, receive, receive, receivedMessage, releaseReceivers, removeListener, resetReceiver, resumeReading, send, setConnectionInvoker, setExternalTransport, setInputSize, setLogMessageFilter, setMessageHandler, setProtocolData, setReceiver, startUpgradeConnection, stopReading, toString, triggerWithObject, upgradeConnection, waitForObject, wrapInProtocolException
getEndpoint
setMessageHandler
getInterceptor
receive, receive
setReceiver
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addListener, removeListener, send
getProtocolId
getProtocolDescription
clearInput, getInputSize, releaseReceivers, setInputSize
resetReceiver
applyConfiguration, createConnection, lookupConnectionParameter
public static final ProtocolDescription PROTOCOL_DESCRIPTION
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()
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 modifyProtocolException
- 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 static void processSendingMessage(FlexChatProtocolHandshakeOptions protocol, Message message) throws ProtocolException
ProtocolException
protected void onReceiveMessage(Message message)
DuplexChannel
onReceiveMessage
in class ClientChannel
message
- received messageprotected static void processReceivedMessage(FlexChatProtocolHandshakeOptions protocol, Message message)
protected com.genesyslab.platform.commons.connection.impl.xml.ProtocolDialect getDialect()
getDialect
in class WebmediaChannel
protected ClientChannel.ClientHandshakeStep getHandshakeStart()
OptionalRegistrationChannel
getHandshakeStart
in class OptionalRegistrationChannel
Send comments on this topicTechpubs.webadmin@genesys.com.
Document version: 9.0.006.00
Copyright © 2006–2019 Genesys Telecommunications Laboratories, Inc. All rights reserved.