Skip to content

Add Elixir example - #32

Open
GiuseppeSaluto wants to merge 1 commit into
aisstream:mainfrom
GiuseppeSaluto:elixir-example
Open

GiuseppeSaluto wants to merge 1 commit into
aisstream:mainfrom
GiuseppeSaluto:elixir-example

Conversation

@GiuseppeSaluto

Copy link
Copy Markdown

Adds an Elixir example, which was missing from the supported languages.

  • elixir/main.exs: minimal client (~60 lines) using WebSockex and the JSON module from the Elixir 1.18 standard library, so it has a single dependency.
  • Dependencies are installed by Mix.install, so it runs with elixir main.exs, no Mix project needed.
  • The API key is read from AISSTREAM_API_KEY, like the Rust and JavaScript examples.
  • The subscription is re-sent on every reconnection, and reconnection backs off up to 30 seconds.
  • WebSockex doesn't support permessage-deflate, so the example uses a small bounding box and notes the limit in a comment, as the Rust example does.

Minimal client using WebSockex and the JSON module from the Elixir 1.18
standard library. Dependencies are installed by Mix.install, so it runs
with `elixir main.exs`. The API key is read from AISSTREAM_API_KEY, the
subscription is re-sent on every reconnection, and reconnection backs
off up to 30 seconds.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant