tigase.jaxmpp.core.client.connector

## Class AbstractWebSocketConnector

- java.lang.Object
- - tigase.jaxmpp.core.client.connector.AbstractWebSocketConnector

- All Implemented Interfaces:
    Connector
  Direct Known Subclasses:
    WebSocketConnector, WebSocketConnector

      public abstract class AbstractWebSocketConnector
      extends Object
      implements Connector

  Author:
    andrzej

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface tigase.jaxmpp.core.client.Connector

      `Connector.ConnectedHandler, Connector.DisconnectedHandler, Connector.EncryptionEstablishedHandler, Connector.ErrorHandler, Connector.StanzaReceivedHandler, Connector.StanzaSendingHandler, Connector.State, Connector.StateChangedHandler, Connector.StreamRestartedHandler, Connector.StreamTerminatedHandler`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Context` | `context`
    `static String` | `FORCE_RFC_KEY`
    `protected Logger` | `log`
    `protected Boolean` | `rfcCompatible`

    - ### Fields inherited from interface tigase.jaxmpp.core.client.Connector

      `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`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractWebSocketConnector(Context context)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    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()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface tigase.jaxmpp.core.client.Connector

      `isSecure`

- - ### Field Detail

    - #### FORCE_RFC_KEY

          public static final String FORCE_RFC_KEY

      See Also:
        Constant Field Values

    - #### context

          protected final Context context

    - #### log

          protected final Logger log

    - #### rfcCompatible

          protected Boolean rfcCompatible

  - ### Constructor Detail

    - #### AbstractWebSocketConnector

          protected AbstractWebSocketConnector(Context context)

  - ### Method Detail

    - #### createSessionLogic

          public XmppSessionLogic createSessionLogic(XmppModulesManager modulesManager,
                                                     PacketWriter writer)

      Description copied from interface: `Connector`
      Returns instance of XmppSessionLogic to work with this connector.
      Specified by:
        `createSessionLogic` in interface `Connector`
      Parameters:
        `modulesManager` - module manager
        `writer` - writer
      Returns:
        XmppSessionLogic

    - #### fireOnConnected

          protected void fireOnConnected(SessionObject sessionObject)
                                  throws JaxmppException

      Throws:
        `JaxmppException`

    - #### fireOnError

          protected void fireOnError(Element response,
                                     Throwable caught,
                                     SessionObject sessionObject)
                              throws JaxmppException

      Throws:
        `JaxmppException`

    - #### fireOnStanzaReceived

          protected void fireOnStanzaReceived(StreamPacket response,
                                              SessionObject sessionObject)
                                       throws JaxmppException

      Throws:
        `JaxmppException`

    - #### fireOnTerminate

          protected void fireOnTerminate(SessionObject sessionObject)
                                  throws JaxmppException

      Throws:
        `JaxmppException`

    - #### getState

          public Connector.State getState()

      Description copied from interface: `Connector`
      Returns current State of connector.
      Specified by:
        `getState` in interface `Connector`
      Returns:
        State of connector.

    - #### getTimeout

          protected Integer getTimeout(String propertyName,
                                       int defaultValue)

      Returns timeout value.
      Parameters:
        `propertyName` - name of property
        `defaultValue` - default value if property is `null`.
      Returns:
        timeout value or `null` if value is less than 0.

    - #### handleSeeOtherHost

          protected boolean handleSeeOtherHost(Element response)
                                        throws JaxmppException

      Throws:
        `JaxmppException`

    - #### handleSeeOtherUri

          protected boolean handleSeeOtherUri(String seeOtherUri)
                                       throws JaxmppException

      Throws:
        `JaxmppException`

    - #### isCompressed

          public boolean isCompressed()

      Description copied from interface: `Connector`
      Returns XML Stream compression state.
      Specified by:
        `isCompressed` in interface `Connector`
      Returns:
        `true> if XML Stream is compressed.`

    - #### isRfc

          protected boolean isRfc()

    - #### keepalive

          public void keepalive()
                         throws JaxmppException

      Description copied from interface: `Connector`
      Whitespace ping.
      Specified by:
        `keepalive` in interface `Connector`
      Throws:
        `JaxmppException`

    - #### onError

          protected void onError(Element response,
                                 Throwable ex)

    - #### onStreamStart

          protected void onStreamStart(Map<String,String> attribs)

    - #### onStreamTerminate

          protected void onStreamTerminate()
                                    throws JaxmppException

      Throws:
        `JaxmppException`

    - #### processElement

          protected void processElement(Element child)
                                 throws JaxmppException

      Throws:
        `JaxmppException`

    - #### restartStream

          public void restartStream()
                             throws JaxmppException

      Description copied from interface: `Connector`
      Sends new XML Stream header.
      Specified by:
        `restartStream` in interface `Connector`
      Throws:
        `JaxmppException`

    - #### send

          public void send(Element stanza)
                    throws JaxmppException

      Description copied from interface: `Connector`
      Sends given XML Element to server.
      Specified by:
        `send` in interface `Connector`
      Parameters:
        `stanza` - XML element to send.
      Throws:
        `JaxmppException`

    - #### send

          protected abstract void send(String data)
                                throws JaxmppException

      Throws:
        `JaxmppException`

    - #### setStage

          protected void setStage(Connector.State state)
                           throws JaxmppException

      Throws:
        `JaxmppException`

    - #### start

          public void start()
                     throws JaxmppException

      Description copied from interface: `Connector`
      Starts connector. If connector is properly configured it will tries to establsh connection with server.
      Specified by:
        `start` in interface `Connector`
      Throws:
        `JaxmppException`

    - #### stop

          public void stop()
                    throws JaxmppException

      Description copied from interface: `Connector`
      Stops connector and closes connections.
      Specified by:
        `stop` in interface `Connector`
      Throws:
        `JaxmppException`

    - #### stop

          public void stop(boolean terminate)
                    throws JaxmppException

      Description copied from interface: `Connector`
      Stops connector.
      Specified by:
        `stop` in interface `Connector`
      Parameters:
        `terminate` - if `true`then connection will be terminated immediatelly and connector will be stopped.``
      Throws:
        `JaxmppException`

    - #### terminateAllWorkers

          protected abstract void terminateAllWorkers()
                                               throws JaxmppException

      Throws:
        `JaxmppException`

    - #### terminateStream

          protected void terminateStream()
                                  throws JaxmppException

      Throws:
        `JaxmppException`

Copyright © 2006–2020 Tigase. All rights reserved.