Skip to content

verypossible/ex_kiwiplan

Repository files navigation

ExKiwiplan

Register a callback function to Kiwiplan Hosts.

Whenever a message is received from a Kiwiplan Host, the callback will be invoked.

Installation

  1. Clone this repo
git clone https://github.com/verypossible-labs/ex_kiwiplan.git

Usage

Add ExKiwiplan to your module's supervision tree:

children = [
  {Kiwiplan.Server, [port: 4040, callback: callback]}
]

Alternativelty, accept the default port 4040 and callback &IO.inspect/1

children = [
  {Kiwiplan.Server, []}
]

Example client

There is also a python client.py for testing sending TCP messages.

  • Start the Kiwiplan Server
    • iex -S mix
    • ExKiwiplan.Server.start_link([])
  • Start the python client
$ python client.py
message: GGKKnore     # input message
'GGKKnore'            # reply
b'\x0201AK\x03'       # ack message

If multiple connections are made, the older will be dropped in favor of the new.

Documentation

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/ex_kiwiplan.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published