space_ex v0.3.0 SpaceEx.Connection
Establishes a connection to a kRPC server.
This is the first step you’ll need in any kRPC program. Every other call in this library depends on having a connection.
Connections allow pipelining. Although the kRPC server will only handle one request at a time (and will always handle requests in order), multiple requests — issued by multiple Elixir processes sharing the same connection — can be “on the wire” at any given time. This dramatically improves performance compared to the standard approach of sending a single request and waiting until it responds.
However, be aware that if you issue a call that blocks for a long time, like
SpaceEx.SpaceCenter.AutoPilot.wait/2
, it will also block all other RPC
calls on the same connection until it returns.
For that reason, if you intend to use blocking calls, but you still want other code to continue issuing calls in the mean time, then you should consider establishing a separate connection for your blocking calls.
Link to this section Summary
Functions
Connects to a kRPC server
Link to this section Functions
Connects to a kRPC server.
opts
is either a SpaceEx.Connection.Info
struct, or a keyword list:
opts[:host]
is the target hostname or IP (default:127.0.0.1
)opts[:port]
is the target port (default:50000
)opts[:name]
is the client name, displayed in the kRPC status window (default: autogenerated & unique)
Returns a connection handle that can be used as the conn
argument in RPC
calls. The connection is linked to the process that started it, so it will
close when that process terminates.