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, serviceListener, 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()`
    `protected char[]` | `readData()`
    `protected void` | `setState(WebSocketXMPPIOService.State state)`
    `void` | `stop()`
    `protected void` | `writeBytes(ByteBuffer data)`
    `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, hasParsedElements, moveParsedPacketsToReceived, 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, getCertificateContainer, getConnectionId, getDataReceiver, getIO, getLastTransferTime, getLocalAddress, getLocalCertificate, getLocalPort, getPeerCertificate, getReadCounters, getRefObject, getRemoteAddress, getSessionData, getSocketChannel, getSocketInputSize, getStatistics, getTlsUniqueId, getTotalBuffOverflow, getTotalBytesReceived, getTotalBytesSent, getUniqueId, getWriteCounters, handleMalformedInput, handshakeCompleted, isConnected, isInputBufferEmpty, isSocketServiceReady, readBytes, readCompleted, setBufferLimit, setCertificateContainer, setConnectionId, setDataReceiver, setIOServiceListener, setRefObject, setSessionData, setSocketServiceReady, setSslContextContainer, 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()

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

    - #### dumpHeaders

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

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

      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

      Overrides:
        `readData` in class `IOService<RefObject>`
      Throws:
        `IOException`

    - #### 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)

      Overrides:
        `writeBytes` in class `IOService<RefObject>`

Copyright © 2004–2019 "Tigase, Inc.". All rights reserved.