Added protocol module stub
This commit is contained in:
parent
0881081d5c
commit
4965013fc9
1 changed files with 16 additions and 0 deletions
16
src/ggs_protocol.erl
Normal file
16
src/ggs_protocol.erl
Normal file
|
@ -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.
|
Reference in a new issue