Class Http2SocketImpl

  • All Implemented Interfaces:
    Http2Socket

    public class Http2SocketImpl
    extends java.lang.Object
    implements Http2Socket
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.concurrent.CompletableFuture<java.lang.Void> close()  
      java.util.concurrent.CompletableFuture<java.lang.Void> connect​(java.net.InetSocketAddress addr)  
      com.webpieces.http2.api.streaming.RequestStreamHandle openStream()
      You should have a pretty good understanding the http/2 spec to use this method.
      java.util.concurrent.CompletableFuture<FullResponse> send​(FullRequest request)
      Can't specifically backpressure with this method(ie.
      java.util.concurrent.CompletableFuture<java.lang.Void> sendPing()
      Future is complete when ping response is returned such that you can measure latency
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Http2SocketImpl

        public Http2SocketImpl​(Http2ChannelProxy channel,
                               com.webpieces.http2engine.api.client.Http2ClientEngineFactory factory,
                               Http2SocketListener socketListener)
    • Method Detail

      • connect

        public java.util.concurrent.CompletableFuture<java.lang.Void> connect​(java.net.InetSocketAddress addr)
        Specified by:
        connect in interface Http2Socket
      • close

        public java.util.concurrent.CompletableFuture<java.lang.Void> close()
        Specified by:
        close in interface Http2Socket
      • send

        public java.util.concurrent.CompletableFuture<FullResponse> send​(FullRequest request)
        Can't specifically backpressure with this method(ie. On the other method, if you do not ack, eventually with too many bytes, the channelmanager disregisters and stops reading from the socket placing backpressure on the socket)
        Specified by:
        send in interface Http2Socket
      • openStream

        public com.webpieces.http2.api.streaming.RequestStreamHandle openStream()
        Description copied from interface: Http2Socket
        You should have a pretty good understanding the http/2 spec to use this method. This method supports EVERY use-case that http/2 has to offer (pretty much). Http1.1 and Http\2 are both a bit complex resulting in a more complex api IF you want to support all use-cases other than just the request/response use-case without blowing up your RAM including 1. send request headers only, then receive response headers and data chunks forever (twitter api does this) 2. send request headers only, then receive response headers and data chunks until end chunk is received -With this, you can stream chunks through your system so it works for very very large file use-cases without storing the whole file in RAM as you can stream it through the system 3. send request headers, then stream request chunks forever (this is sometimes a use-case) 4. send request headers and send data chunks, then receive response headers 5. send request headers and send data chunks, then receive response headers and data chunks
        Specified by:
        openStream in interface Http2Socket
      • sendPing

        public java.util.concurrent.CompletableFuture<java.lang.Void> sendPing()
        Description copied from interface: Http2Socket
        Future is complete when ping response is returned such that you can measure latency
        Specified by:
        sendPing in interface Http2Socket