|
@@ -21,6 +21,10 @@ init(_Transport, Req, _Opts, _Active) ->
|
|
|
|
|
|
%% {'KamfMessage',23,game_event,[{game,undefined},{event,okey_tile_taken},{args,[{player,<<"dusler">>},{pile,0},{revealed,null},{pile_height,43}]}]}
|
|
%% {'KamfMessage',23,game_event,[{game,undefined},{event,okey_tile_taken},{args,[{player,<<"dusler">>},{pile,0},{revealed,null},{pile_height,43}]}]}
|
|
|
|
|
|
|
|
+is_proplist([]) -> true;
|
|
|
|
+is_proplist([{K,_}|L]) when is_atom(K) -> is_proplist(L);
|
|
|
|
+is_proplist(_) -> false.
|
|
|
|
+
|
|
stream(<<"ping">>, Req, State) ->
|
|
stream(<<"ping">>, Req, State) ->
|
|
wf:info("ping received~n"),
|
|
wf:info("ping received~n"),
|
|
{reply, <<"pong">>, Req, State};
|
|
{reply, <<"pong">>, Req, State};
|
|
@@ -32,6 +36,9 @@ stream({binary,Info}, Req, State) ->
|
|
wf:info("Binary Received: ~p",[Info]),
|
|
wf:info("Binary Received: ~p",[Info]),
|
|
Pro = binary_to_term(Info,[safe]),
|
|
Pro = binary_to_term(Info,[safe]),
|
|
wf:info("N2O Unknown Event: ~p",[Pro]),
|
|
wf:info("N2O Unknown Event: ~p",[Pro]),
|
|
|
|
+ case Pro of
|
|
|
|
+ {client,M} -> info({client,M},Req,State);
|
|
|
|
+ _ ->
|
|
Pickled = proplists:get_value(pickle,Pro),
|
|
Pickled = proplists:get_value(pickle,Pro),
|
|
Linked = proplists:get_value(linked,Pro),
|
|
Linked = proplists:get_value(linked,Pro),
|
|
Depickled = wf:depickle(Pickled),
|
|
Depickled = wf:depickle(Pickled),
|
|
@@ -55,7 +62,7 @@ stream({binary,Info}, Req, State) ->
|
|
RenderGenActions = wf:render(GenActions),
|
|
RenderGenActions = wf:render(GenActions),
|
|
wf_context:clear_actions(),
|
|
wf_context:clear_actions(),
|
|
|
|
|
|
- {reply, [Render,RenderGenActions], Req, State};
|
|
|
|
|
|
+ {reply, [Render,RenderGenActions], Req, State} end;
|
|
stream(Data, Req, State) ->
|
|
stream(Data, Req, State) ->
|
|
wf:info("Data Received ~p",[Data]),
|
|
wf:info("Data Received ~p",[Data]),
|
|
self() ! Data,
|
|
self() ! Data,
|
|
@@ -68,6 +75,10 @@ render_actions(InitActions) ->
|
|
wf_context:clear_actions(),
|
|
wf_context:clear_actions(),
|
|
[RenderInit,RenderInitGenActions].
|
|
[RenderInit,RenderInitGenActions].
|
|
|
|
|
|
|
|
+info({client,Message}, Req, State) ->
|
|
|
|
+ wf:info("Client Message: ~p",[Message]),
|
|
|
|
+ {reply,[],Req,State};
|
|
|
|
+
|
|
info({send_message,Message}, Req, State) ->
|
|
info({send_message,Message}, Req, State) ->
|
|
wf:info("Game Message: ~p",[Message]),
|
|
wf:info("Game Message: ~p",[Message]),
|
|
Ret = io_lib:format("~p",[Message]),
|
|
Ret = io_lib:format("~p",[Message]),
|
|
@@ -105,7 +116,7 @@ info(Pro, Req, State) ->
|
|
end;
|
|
end;
|
|
<<"PING">> -> [];
|
|
<<"PING">> -> [];
|
|
Unknown ->
|
|
Unknown ->
|
|
- wf:info("unk ~p", [Unknown]),
|
|
|
|
|
|
+ wf:info("Unknown WS Info Message ~p", [Unknown]),
|
|
M = State#context.module,
|
|
M = State#context.module,
|
|
catch M:event(Unknown),
|
|
catch M:event(Unknown),
|
|
Actions = get(actions),
|
|
Actions = get(actions),
|