From 4965013fc99f8bfec49e4d161de4cbb90f7183de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonatan=20P=C3=A5lsson?= Date: Sun, 30 Jan 2011 14:10:01 +0100 Subject: [PATCH] Added protocol module stub --- src/ggs_protocol.erl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/ggs_protocol.erl diff --git a/src/ggs_protocol.erl b/src/ggs_protocol.erl new file mode 100644 index 0000000..edce09c --- /dev/null +++ b/src/ggs_protocol.erl @@ -0,0 +1,16 @@ +%% This is a parser for JSON implemented using mochijson2 +%% Don't feed it anything other than valid JSON. + +-module(ggs_protocol). +-export([parse/1]). + +parse(JSONData) -> + {struct, Struct} = js_mochijson2:decode(JSONData), + RequestType = proplists:get_value(<<"request">>, Struct), + case RequestType of + <<"define">> -> + ok_you_said_define; + Other -> + io:format("~p", [RequestType]), + ok_i_dont_understand + end.