Class WebSocketTransport

java.lang.Object
org.apache.qpid.protonj2.client.transport.netty4.TcpTransport
org.apache.qpid.protonj2.client.transport.netty4.WebSocketTransport
All Implemented Interfaces:
Transport

public class WebSocketTransport extends TcpTransport
Netty based WebSockets Transport that wraps and extends the TCP Transport.
  • Constructor Details

    • WebSocketTransport

      public WebSocketTransport(io.netty.bootstrap.Bootstrap bootstrap, TransportOptions options, SslOptions sslOptions)
      Create a new WebSocketTransport instance with the given configuration.
      Parameters:
      bootstrap - the Bootstrap that this transport's IO is bound to.
      options - the TransportOptions used to configure the socket connection.
      sslOptions - the SslOptions to use if the options indicate SSL is enabled.
  • Method Details

    • write

      public WebSocketTransport write(ProtonBuffer output, Runnable onComplete) throws IOException
      Description copied from interface: Transport
      Writes a chunk of data over the Transport connection without performing an explicit flush on the transport. This method allows for a completion callback that is signaled when the actual low level IO operation is completed which could be after this method has returned.
      Specified by:
      write in interface Transport
      Overrides:
      write in class TcpTransport
      Parameters:
      output - The buffer of data that is to be transmitted.
      onComplete - A Runnable that is invoked when the IO operation completes successfully.
      Returns:
      this Transport instance.
      Throws:
      IOException - if an error occurs during the write operation.
    • writeAndFlush

      public WebSocketTransport writeAndFlush(ProtonBuffer output, Runnable onComplete) throws IOException
      Description copied from interface: Transport
      Writes a chunk of data over the Transport connection and requests a flush of all pending queued write operations
      Specified by:
      writeAndFlush in interface Transport
      Overrides:
      writeAndFlush in class TcpTransport
      Parameters:
      output - The buffer of data that is to be transmitted.
      onComplete - A Runnable that is invoked when the IO operation completes successfully.
      Returns:
      this Transport instance.
      Throws:
      IOException - if an error occurs during the write operation.
    • getRemoteURI

      public URI getRemoteURI()
      Description copied from interface: Transport
      Returns a URI that contains some meaningful information about the remote connection such as a scheme that reflects the transport type and the remote host and port that the connection was instructed to connect to. If called before the Transport.connect(String, int, TransportListener) method this method returns null.
      Specified by:
      getRemoteURI in interface Transport
      Overrides:
      getRemoteURI in class TcpTransport
      Returns:
      a URI that reflects a meaningful view of the Transport remote connection details.
    • createChannelHandler

      protected io.netty.channel.ChannelInboundHandlerAdapter createChannelHandler()
      Overrides:
      createChannelHandler in class TcpTransport
    • addAdditionalHandlers

      protected void addAdditionalHandlers(io.netty.channel.ChannelPipeline pipeline)
      Overrides:
      addAdditionalHandlers in class TcpTransport
    • handleConnected

      protected void handleConnected(io.netty.channel.Channel channel) throws Exception
      Overrides:
      handleConnected in class TcpTransport
      Throws:
      Exception
    • getScheme

      protected String getScheme()
      Overrides:
      getScheme in class TcpTransport