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.