space_ex v0.5.1 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.

info is either a SpaceEx.Connection.Info struct, or a keyword list:

  • info[:host] is the target hostname or IP (default: 127.0.0.1)
  • info[:port] is the target port (default: 50000)
  • info[: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 lifecycle of a connection is tied to the process that creates it. If that process exits or crashes, the connection will be shut down.