Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
oberernst committed Mar 14, 2022
1 parent 3e50851 commit 5a0e5b1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,10 @@ UNDER CONSTRUCTION! It's still a rough draft that I'm ripping to shreds constant
* can be started with arbitrary `handler` function for extending functionality

## Overview
Macrina is an attempt to hew as close as possible to the language of the RFC. As such, the `Endpoint` is the root of the concept. Starting an `Endpoint` with a given IP and Port combination is analogous to binding a webserver implementation to `"127.0.0.1:4000"`. The `Endpoint` itself is a `GenServer` that opens a UDP socket with `:gen_udp`. Incoming UDP packets are dispatched to `Connection` processes, one per sender IP/Port. The `Connection` handles decoding the binary CoAP message into a `Macrina.Message` and does two things with any given message: calls a provided `Handler` `call/2` function whose purpose is replying to the CoAP request, and routes that message to any `Macrina.Client` that may have been expecting it as the response to some call it made. This illustrates an important point: the `Connection` module is used by `Macrina.Client` for sending outbound requests as well as by the app internally as a server implementation piece.
Macrina is an attempt to hew as close as possible to the language of the RFC. As such, the `Endpoint` is the root of the concept.

Starting an `Endpoint` with a given IP and Port combination is analogous to binding a webserver implementation to `"127.0.0.1:4000"`. The `Endpoint` itself is a `GenServer` that opens a UDP socket with `:gen_udp`. Incoming UDP packets are dispatched to `Connection` processes, one per sender IP/Port.

The `Connection` handles decoding the binary CoAP message into a `Macrina.Message` and does two things with any given message: calls a provided `Handler` `call/2` function whose purpose is replying to the CoAP request, and routes that message to any `Macrina.Client` that may have been expecting it as the response to some call it made.

This illustrates an important point: the `Connection` module is used by `Macrina.Client` for sending outbound requests as well as by the app internally as a server implementation piece.

0 comments on commit 5a0e5b1

Please sign in to comment.