public abstract class AbstractWebSocketConnector extends Object implements Connector
Connector.ConnectedHandler, Connector.DisconnectedHandler, Connector.EncryptionEstablishedHandler, Connector.ErrorHandler, Connector.StanzaReceivedHandler, Connector.StanzaSendingHandler, Connector.State, Connector.StateChangedHandler, Connector.StreamRestartedHandler, Connector.StreamTerminatedHandler
Modifier and Type | Field and Description |
---|---|
protected Context |
context |
static String |
FORCE_RFC_KEY |
protected Logger |
log |
protected Boolean |
rfcCompatible |
COMPRESSED_KEY, CONNECTOR_STAGE_KEY, CONNECTOR_STAGE_TIMESTAMP_KEY, DISABLE_KEEPALIVE_KEY, ENCRYPTED_KEY, EXTERNAL_KEEPALIVE_KEY, PROXY_HOST, PROXY_PORT, PROXY_TYPE, RECONNECTING_KEY, SEE_OTHER_HOST_KEY, TRUST_MANAGERS_KEY
Modifier | Constructor and Description |
---|---|
protected |
AbstractWebSocketConnector(Context context) |
Modifier and Type | Method and Description |
---|---|
XmppSessionLogic |
createSessionLogic(XmppModulesManager modulesManager,
PacketWriter writer)
Returns instance of XmppSessionLogic to work with this
connector.
|
protected void |
fireOnConnected(SessionObject sessionObject) |
protected void |
fireOnError(Element response,
Throwable caught,
SessionObject sessionObject) |
protected void |
fireOnStanzaReceived(StreamPacket response,
SessionObject sessionObject) |
protected void |
fireOnTerminate(SessionObject sessionObject) |
Connector.State |
getState()
Returns current State of connector.
|
protected Integer |
getTimeout(String propertyName,
int defaultValue)
Returns timeout value.
|
protected boolean |
handleSeeOtherHost(Element response) |
protected boolean |
handleSeeOtherUri(String seeOtherUri) |
boolean |
isCompressed()
Returns XML Stream compression state.
|
protected boolean |
isRfc() |
void |
keepalive()
Whitespace ping.
|
protected void |
onError(Element response,
Throwable ex) |
protected void |
onStreamStart(Map<String,String> attribs) |
protected void |
onStreamTerminate() |
protected void |
processElement(Element child) |
void |
restartStream()
Sends new XML Stream header.
|
void |
send(Element stanza)
Sends given XML Element to server.
|
protected abstract void |
send(String data) |
protected void |
setStage(Connector.State state) |
void |
start()
Starts connector.
|
void |
stop()
Stops connector and closes connections.
|
void |
stop(boolean terminate)
Stops connector.
|
protected abstract void |
terminateAllWorkers() |
protected void |
terminateStream() |
public static final String FORCE_RFC_KEY
protected final Context context
protected final Logger log
protected Boolean rfcCompatible
protected AbstractWebSocketConnector(Context context)
public XmppSessionLogic createSessionLogic(XmppModulesManager modulesManager, PacketWriter writer)
Connector
createSessionLogic
in interface Connector
modulesManager
- module managerwriter
- writerprotected void fireOnConnected(SessionObject sessionObject) throws JaxmppException
JaxmppException
protected void fireOnError(Element response, Throwable caught, SessionObject sessionObject) throws JaxmppException
JaxmppException
protected void fireOnStanzaReceived(StreamPacket response, SessionObject sessionObject) throws JaxmppException
JaxmppException
protected void fireOnTerminate(SessionObject sessionObject) throws JaxmppException
JaxmppException
public Connector.State getState()
Connector
protected Integer getTimeout(String propertyName, int defaultValue)
propertyName
- name of propertydefaultValue
- default value if property is null
.null
if value is less than 0.protected boolean handleSeeOtherHost(Element response) throws JaxmppException
JaxmppException
protected boolean handleSeeOtherUri(String seeOtherUri) throws JaxmppException
JaxmppException
public boolean isCompressed()
Connector
isCompressed
in interface Connector
true> if XML Stream is compressed.
protected boolean isRfc()
public void keepalive() throws JaxmppException
Connector
keepalive
in interface Connector
JaxmppException
protected void onStreamTerminate() throws JaxmppException
JaxmppException
protected void processElement(Element child) throws JaxmppException
JaxmppException
public void restartStream() throws JaxmppException
Connector
restartStream
in interface Connector
JaxmppException
public void send(Element stanza) throws JaxmppException
Connector
send
in interface Connector
stanza
- XML element to send.JaxmppException
protected abstract void send(String data) throws JaxmppException
JaxmppException
protected void setStage(Connector.State state) throws JaxmppException
JaxmppException
public void start() throws JaxmppException
Connector
start
in interface Connector
JaxmppException
public void stop() throws JaxmppException
Connector
stop
in interface Connector
JaxmppException
public void stop(boolean terminate) throws JaxmppException
Connector
stop
in interface Connector
terminate
- if true then connection will be terminated immediatelly and connector will be
stopped.
JaxmppException
protected abstract void terminateAllWorkers() throws JaxmppException
JaxmppException
protected void terminateStream() throws JaxmppException
JaxmppException
Copyright © 2006–2023 Tigase. All rights reserved.