Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for for interaction with NervesHub and NervesHubWeb #31

Open
ConnorRigby opened this issue Oct 15, 2018 · 0 comments
Open
Assignees
Labels
discussion enhancement New feature or request

Comments

@ConnorRigby
Copy link
Collaborator

Right now there is only one FirmwareChannel open between NervesHub and NervesHubWeb. I think as more features are implemented, it's going to be hard to wedge documentation of the messages passed back and forth over the socket and we should consider adopting a common message format/RPC format.

In other apps i usually use a format along the lines of:

@typedoc "Common RPC format"
@type t %__MODULE__{
   kind: atom(),
   args: map()
}

@type firmware_update_rpc :: %__MODULE__{
  kind: :firmware_update,
  args: %{required(:url) => String.t()}
}

@type some_other_rpc :: %__MODULE__{
  kind: :some_other,
  args: %{optional(:data) => number}
}

@typedoc "All possible RPCs that need to be implemented"
@type rpc :: firmware_update_rpc | some_other_rpc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants