go.uber.org/yarpc@v1.72.1/transport/http/doc.go (about)

     1  // Copyright (c) 2022 Uber Technologies, Inc.
     2  //
     3  // Permission is hereby granted, free of charge, to any person obtaining a copy
     4  // of this software and associated documentation files (the "Software"), to deal
     5  // in the Software without restriction, including without limitation the rights
     6  // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     7  // copies of the Software, and to permit persons to whom the Software is
     8  // furnished to do so, subject to the following conditions:
     9  //
    10  // The above copyright notice and this permission notice shall be included in
    11  // all copies or substantial portions of the Software.
    12  //
    13  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    14  // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    15  // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    16  // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    17  // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    18  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    19  // THE SOFTWARE.
    20  
    21  // Package http implements a YARPC transport based on the HTTP/1.1 protocol.
    22  // The HTTP transport provides first class support for Unary RPCs and
    23  // experimental support for Oneway RPCs.
    24  //
    25  // Usage
    26  //
    27  // An HTTP Transport must be constructed to use this transport.
    28  //
    29  // 	httpTransport := http.NewTransport()
    30  //
    31  // To serve your YARPC application over HTTP, pass an HTTP inbound in your
    32  // yarpc.Config.
    33  //
    34  // 	myInbound := httpTransport.NewInbound(":8080")
    35  // 	dispatcher := yarpc.NewDispatcher(yarpc.Config{
    36  // 		Name: "myservice",
    37  // 		Inbounds: yarpc.Inbounds{myInbound},
    38  // 	})
    39  //
    40  // To make requests to a YARPC application that supports HTTP, pass an HTTP
    41  // outbound in your yarpc.Config.
    42  //
    43  // 	myserviceOutbound := httpTransport.NewSingleOutbound("http://127.0.0.1:8080")
    44  // 	dispatcher := yarpc.NewDispatcher(yarpc.Config{
    45  // 		Name: "myclient",
    46  // 		Outbounds: yarpc.Outbounds{
    47  // 			"myservice": {Unary: myserviceOutbound},
    48  // 		},
    49  // 	})
    50  //
    51  // Note that stopping an HTTP transport does NOT immediately terminate ongoing
    52  // requests. Connections will remain open until all clients have disconnected.
    53  //
    54  // Configuration
    55  //
    56  // An HTTP Transport may be configured using YARPC's configuration system. See
    57  // TransportConfig, InboundConfig, and OutboundConfig for details on the
    58  // different configuration parameters supported by this transport.
    59  //
    60  // Wire Representation
    61  //
    62  // YARPC requests and responses are sent as plain HTTP requests and responses.
    63  // YARPC metadata is sent inside reserved HTTP headers. Application headers
    64  // for requests and responses are sent as HTTP headers with the header names
    65  // prefixed with a pre-defined string. See Constants for more information on
    66  // the names of these headers. The request and response bodies are sent as-is
    67  // in the HTTP request or response body.
    68  //
    69  // See Also
    70  //
    71  // YARPC Properties: https://github.com/yarpc/yarpc/blob/master/properties.md
    72  package http