aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md19
1 files changed, 19 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..de5494f
--- /dev/null
+++ b/README.md
@@ -0,0 +1,19 @@
+Some erlang helpers for COAP messages (RFC7252)
+
+Copyright 2015 Guido G√ľnther <agx@sigxcpu.org>
+
+This is by no means a full coap implementation. It merely allows to ease
+parsing of messages a bit by putting things into a record.
+
+Let's assume you receive UDP datagrams in a gen_server. You can then match on
+the incoming coap message like:
+
+ handle_info({udp, Socket, Host, Port, Bin}, State) ->
+ Msg = coap_parse:parse(Bin),
+ case Msg of
+ #coap_request{method=post, path= <<"/switches">>, query=[<<"name=", Name/binary>>], payload=Payload} ->
+ ...
+
+Which would allow you to process a request like:
+
+ echo '{"mode": "on"}' | coap-client -f- -t application/json -m post "coap://[::1]/switches?name=Lever1"