Fedecks Server

Provides a websocket for a Phoenix application, for establishing communications with a Fedecks Client, probably running on a Nerves Device.

usage

Usage

Add to deps

{:fedecks_server, "~> 0.1"}

Implement a FedecksServer.FedecksHandler to handle connecting and upstream messages. See module for callbacks.

Add the endpoint with FedecksServer.Socket.fedecks_socket/2. Eg

defmodule MyApp.Endpoint
  use Phoenix.Endpoint, otp_app: :my_app

  import FedecksServer.Socket, only: [fedecks_socket: 1]

  fedecks_socket(MyApp.SocketHandler)
end

Messages are received from the Fedecks Client primarily as Erlang terms and handled by the FedecksServer.FedecksHandler.handle_in/2 callback. (Note that the terms are safe decoded, so it is best to avoid atoms in the messages).

The FedecksClient is not yet on Hex, but can be found in Github here.