Cables v0.1.0 Cables View Source
Asynchronous multiplexed HTTP/2 connection manager.
Create a new Cable using Cable.ensure_connection/2
. Cables will not open a connection
until the first request is recieved.
Examples
{:ok, cable} = Cables.ensure_connection("https://httpbin.org/")
{:ok, %Cables.Response{status: 200}} = Cables.get(cable, "/get")
Link to this section Summary
Functions
Simple DELETE request with Cables.Response
If a pool is not already created for the specified uri, create one
Simple GET request with Cables.Response
Simple HEAD request with Cables.Response
Simple OPTIONS request with Cables.Response
Simple PATCH request with Cables.Response
Simple POST request with Cables.Response
Simple PUT request with Cables.Response
Start a request and handle it with the request_handler. Cables.Handler
This gives you full control over sending and recieving stream data
Send a piece of data. Make sure to use &send_final_data/3 to send the final chunk
Send a piece of data and indicate that the request body has finished
Link to this section Types
http_method() :: :get | :post | :head | :put | :patch | :options | :delete | String.t()
Link to this section Functions
Simple DELETE request with Cables.Response
Examples
iex> {:ok, cable} = Cables.ensure_connection("https://httpbin.org/")
...> {:ok, %Cables.Response{status: status}} = Cables.delete(cable, "/delete")
...> status
200
If a pool is not already created for the specified uri, create one.
Simple GET request with Cables.Response
Examples
iex> {:ok, cable} = Cables.ensure_connection("https://httpbin.org/")
...> {:ok, %Cables.Response{status: status}} = Cables.get(cable, "/get")
...> status
200
Simple HEAD request with Cables.Response
Simple OPTIONS request with Cables.Response
Simple PATCH request with Cables.Response
Examples
iex> {:ok, cable} = Cables.ensure_connection("https://httpbin.org/")
...> {:ok, %Cables.Response{status: status}} = Cables.patch(cable, "/patch", [], "hello world")
...> status
200
Simple POST request with Cables.Response
Examples
iex> {:ok, cable} = Cables.ensure_connection("https://httpbin.org/")
...> {:ok, %Cables.Response{status: status}} = Cables.post(cable, "/post", [], "hello world")
...> status
200
Simple PUT request with Cables.Response
Examples
iex> {:ok, cable} = Cables.ensure_connection("https://httpbin.org/")
...> {:ok, %Cables.Response{status: status}} = Cables.put(cable, "/put", [], "hello world")
...> status
200
Start a request and handle it with the request_handler. Cables.Handler
This gives you full control over sending and recieving stream data.
For an example see Cables.Response
.
Examples
iex> {:ok, cable} = Cables.ensure_connection("https://httpbin.org/")
...> {:ok, %Cables.Response{status: status}} = Cables.request(cable, :get, "/get", Cables.Response, nil)
...> status
200
Send a piece of data. Make sure to use &send_final_data/3 to send the final chunk.
Send a piece of data and indicate that the request body has finished.