marcelog / elixir_ami

An Elixir AMI client
Apache License 2.0
13 stars 8 forks source link

(KeyError) key :connection_timeout not found #3

Open voteleobrown opened 6 years ago

voteleobrown commented 6 years ago

So pardon me if this issue is due to my own lack of understanding, but I'm getting the error:

Compiling 1 file (.ex)

== Compilation error in file lib/elixir_ami_test.ex ==
** (KeyError) key :connection_timeout not found
    expanding struct: ElixirAmi.Connection.__struct__/1
    lib/elixir_ami_test.ex:7: ElixirAmiTest (module)
    (elixir) lib/kernel/parallel_compiler.ex:206: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6 

When running iex -S mix with the following code in lib/elixir_ami_test.ex:

defmodule ElixirAmiTest do

  alias ElixirAmi.Connection, as: Conn
  alias ElixirAmi.Action, as: Action

  connection_data = %Conn{
      name: :my_connection,       # The gen_server connection will be registered with this name
      host: "<host_ip>",
      port: 5038,
      username: "<user>",
      password: "<secret>",
      connection_timeout: 5000,   # How many millseconds to wait when connecting
      reconnect_timeout: 5000,    # Wait this many milliseconds before attempting reconnection,
      ssl_options: nil            # Or [ssl:ssl_option()]. Will try a regular TCP connection if this value is nil
  }

  {:ok, pid} = Conn.start_link connection_data

  Conn.send_action :my_connection, Action.ping

end

Am I missing something here? I also tried putting the Conn.send_action line in a function called main like so:

  def main do
    Conn.send_action :my_connection, Action.ping
  end

...to no avail.