tigase.server.websocket

## Class WebSocketXMPPIOService<RefObject>

- java.lang.Object
- - tigase.net.IOService<RefObject>
  - - tigase.xmpp.XMPPIOService<RefObject>
    - - tigase.server.websocket.WebSocketXMPPIOService<RefObject>

- Type Parameters:
    `RefObject` -
  All Implemented Interfaces:
    Callable<IOService<?>>, TLSEventHandler, IOListener

      public class WebSocketXMPPIOService<RefObject>
      extends XMPPIOService<RefObject>

  Class implements basic support for WebSocket protocol. It extends XMPPIOService so it can be used instead of XMPPIOService in ClientConnectionManager to allow web clients to connect to it without using BOSH extension.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `WebSocketXMPPIOService.State`
    `static class` | `WebSocketXMPPIOService.WebSocketXMPPSpec`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected long` | `frameLength`
    `protected byte[]` | `maskingKey`

    - ### Fields inherited from class tigase.xmpp.XMPPIOService

      `ACK_NAME, CROSS_DOMAIN_POLICY_FILE_PROP_KEY, CROSS_DOMAIN_POLICY_FILE_PROP_VAL, DOM_HANDLER, ID_ATT, parser, processors, REQ_NAME, STREAM_CLOSING, writeInProgress`

    - ### Fields inherited from class tigase.net.IOService

      `cb, CERT_CHECK_RESULT, CERT_REQUIRED_DOMAIN, decoder, encoder, HOSTNAME_KEY, partialCharacterBytes, PORT_TYPE_PROP_KEY, SESSION_ID_KEY, SSL_PROTOCOLS_KEY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `WebSocketXMPPIOService(WebSocketProtocolIfc[] enabledProtocols)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `addReceivedPacket(Packet packet)` Method `addReceivedPacket` puts processing results to queue.
    `void` | `dumpHeaders(Map<String,String> headers)`
    `protected WebSocketXMPPIOService.State` | `getState()`
    `protected WebSocketXMPPIOService.WebSocketXMPPSpec` | `getWebSocketXMPPSpec()`
    `protected int` | `parseHttpHeaders(byte[] buf, Map<String,String> headers)`
    `protected String` | `prepareStreamClose()`
    `protected void` | `processSocketData()` Method description
    `protected char[]` | `readData()` Describe `readData` method here.
    `protected void` | `setState(WebSocketXMPPIOService.State state)`
    `void` | `stop()` Describe `stop` method here.
    `protected void` | `writeBytes(ByteBuffer data)` Method description
    `protected void` | `writeData(String data)` Custom implementation of writeData function which encodes data in WebSocket protocol frames

    - ### Methods inherited from class tigase.xmpp.XMPPIOService

      `addPacketToSend, call, checkBufferLimit, checkData, clearWaitingPackets, forceStop, getLastXmppPacketReceiveTime, getPacketsReceived, getPacketsSent, getReceivedPackets, getTotalPacketsReceived, getTotalPacketsSent, getUserJid, getWaitingForAct, getWaitingPackets, getXMLNS, processWaitingPackets, receivedPackets, setAckMode, setElementLimits, setIOServiceListener, setProcessors, setUserJid, setXMLNS, toString, writeRawData, xmppStreamClosed, xmppStreamOpen, xmppStreamOpened`

    - ### Methods inherited from class tigase.net.IOService

      `accept, byteOrder, connectionType, debug, debug, getBuffOverflow, getBytesReceived, getBytesSent, getConnectionId, getDataReceiver, getLastTransferTime, getLocalAddress, getLocalCertificate, getLocalPort, getPeerCertificate, getReadCounters, getRefObject, getRemoteAddress, getSessionData, getSocketChannel, getStatistics, getTlsUniqueId, getTotalBuffOverflow, getTotalBytesReceived, getTotalBytesSent, getUniqueId, getWriteCounters, getX509TrustManagers, handshakeCompleted, isConnected, isInputBufferEmpty, isSocketServiceReady, readBytes, readCompleted, setBufferLimit, setConnectionId, setDataReceiver, setIOServiceListener, setRefObject, setSessionData, setSocketServiceReady, setX509TrustManagers, startSSL, startTLS, startZLib, waitingToRead, waitingToSend, waitingToSendSize`

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

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

- - ### Field Detail

    - #### frameLength

          protected long frameLength

    - #### maskingKey

          protected byte[] maskingKey

  - ### Constructor Detail

    - #### WebSocketXMPPIOService

          public WebSocketXMPPIOService(WebSocketProtocolIfc[] enabledProtocols)

  - ### Method Detail

    - #### stop

          public void stop()

      Description copied from class: `IOService`
      Describe `stop` method here.
      Overrides:
        `stop` in class `XMPPIOService<RefObject>`

    - #### getState

          protected WebSocketXMPPIOService.State getState()

    - #### setState

          protected void setState(WebSocketXMPPIOService.State state)

    - #### addReceivedPacket

          protected void addReceivedPacket(Packet packet)

      Description copied from class: `XMPPIOService`
      Method `addReceivedPacket` puts processing results to queue. The processing results are usually data (messages) which has been just received from socket.
      Overrides:
        `addReceivedPacket` in class `XMPPIOService<RefObject>`
      Parameters:
        `packet` - a `Packet` value of processing results.

    - #### processSocketData

          protected void processSocketData()
                                    throws IOException

      Description copied from class: `IOService`
      Method description
      Overrides:
        `processSocketData` in class `XMPPIOService<RefObject>`
      Throws:
        `IOException`

    - #### getWebSocketXMPPSpec

          protected WebSocketXMPPIOService.WebSocketXMPPSpec getWebSocketXMPPSpec()

    - #### prepareStreamClose

          protected String prepareStreamClose()

      Overrides:
        `prepareStreamClose` in class `XMPPIOService<RefObject>`

    - #### readData

          protected char[] readData()
                             throws IOException

      Description copied from class: `IOService`
      Describe `readData` method here.
      Overrides:
        `readData` in class `IOService<RefObject>`
      Returns:
        a `char[]` value
      Throws:
        `IOException` - if an error occurs

    - #### writeData

          protected void writeData(String data)

      Custom implementation of writeData function which encodes data in WebSocket protocol frames
      Overrides:
        `writeData` in class `IOService<RefObject>`
      Parameters:
        `data` -

    - #### parseHttpHeaders

          protected int parseHttpHeaders(byte[] buf,
                                         Map<String,String> headers)

    - #### writeBytes

          protected void writeBytes(ByteBuffer data)

      Description copied from class: `IOService`
      Method description
      Overrides:
        `writeBytes` in class `IOService<RefObject>`

    - #### dumpHeaders

          public void dumpHeaders(Map<String,String> headers)

Copyright © 2018 "Tigase, Inc.". All rights reserved.