10 Interfaces
jeena edited this page 2011-02-14 13:22:11 -08:00

ggs_vm_runner

start_link() -> GameVm
define(GameVM, SourceCode) -> ok
user_command(GameVM, User, Command, Args) -> ok

Only start_link() has a return value, the other two always return ok.

ggs_server

handle_cast(stop, State) -> {stop, normal, State}
handle_cast({server, hello, Headers}, State) -> {noreply, NewState}
handle_cast({server, define, Headers, Data}, State) -> {noreply, NewState}
handle_cast({game, Command, Headers, Data}, State) -> {noreply, NewState}
  • Headers are a proplist http://www.erlang.org/doc/man/proplists.html so you can use proplist:get_value(token) to get the value of the header "Token".
  • Data is just a String.
  • server and game are atoms to indicate the receiver.
  • Command is just a String.

ggs_protocol

parse(RawData) -> {Headers, DataString}
create(Headers, DataString) -> RawData