Protein v0.8.0 Protein.HTTPAdapter View Source
Transports RPC calls through HTTP requests protected by secret header.
DEPRECATED: The HTTP adapter doesn’t support the push flow and it doesn’t have a server component, which means it can only play a role of a call flow client for the RPC server implemented in other languages.
While both of these could be implemented (with push client implemented via spawn and without caring about spawned process failures or server temporary downtime and the server component implemented either as Plug module or stand-alone cowboy server), all of these functionalities are a better fit for the
Protein.AMQPAdapter
and hence that’s the recommended transport method in such cases.
Usage
In order to use this adapter in your client, use the following code:
defmodule MyProject.RemoteRPC do
use Protein.Client
transport :http,
url: "https://app.example.com/rpc",
secret: "remote-rpc-secret"
# ...
end
You can also configure the adapter per environment in your Mix config as follows:
config :my_project, MyProject.RemoteRPC,
transport: [adapter: :http,
url: {:system, "REMOTE_RPC_URL"},
secret: {:system, "REMOTE_RPC_SECRET"}]