|
@@ -0,0 +1,55 @@
|
|
|
+-module(n4u_heart).
|
|
|
+
|
|
|
+-export([info/3]).
|
|
|
+
|
|
|
+
|
|
|
+info({text, <<"PING">> = _Ping} = Message, Req, State) ->
|
|
|
+ wf:info(?MODULE, "PING: ~p", [Message]),
|
|
|
+ {reply, <<"PONG">>, Req, State};
|
|
|
+
|
|
|
+info({text, <<"N4U,", Process/binary>> = _InitMarker} = Message, Req, State) ->
|
|
|
+ wf:info(?MODULE, "N4U INIT: ~p", [Message]),
|
|
|
+ n2o_proto:push({init, Process}, Req, State, n2o_proto:protocols(), []);
|
|
|
+
|
|
|
+
|
|
|
+% ETS access protocol
|
|
|
+info({cache, 'get', Key, _}, Req, State) ->
|
|
|
+ {reply, wf:cache(Key), Req, State};
|
|
|
+
|
|
|
+info({cache, set, Key, Value}, Req, State) ->
|
|
|
+ {reply, wf:cache(Key, Value), Req, State};
|
|
|
+
|
|
|
+
|
|
|
+info({session, 'get', Key, _}, Req, State) ->
|
|
|
+ {reply, wf:session(Key), Req, State};
|
|
|
+
|
|
|
+info({session, set, Key, Value}, Req, State) ->
|
|
|
+ {reply, wf:session(Key, Value), Req, State};
|
|
|
+
|
|
|
+
|
|
|
+% MQ protocol
|
|
|
+info({pub, _Topic, _Message} = _Message2, Req, State) -> {reply, <<"OK">>, Req, State};
|
|
|
+info({sub, _Topic, _Args} = _Message, Req, State) -> {reply, <<"OK">>, Req, State};
|
|
|
+info({unsub, _Topic} = _Message, Req, State) -> {reply, <<"OK">>, Req, State};
|
|
|
+
|
|
|
+
|
|
|
+% todo - check where/how this used
|
|
|
+% Web Framework protocol
|
|
|
+info({q, _Operation, _Key} = _Message, Req, State) -> {reply, <<"OK">>, Req, State};
|
|
|
+info({qc, _Operation, _Key} = _Message, Req, State) -> {reply, <<"OK">>, Req, State};
|
|
|
+info({cookie, _Operation, _Key, _Value} = _Message, Req, State) -> {reply, <<"OK">>, Req, State};
|
|
|
+info({wire, _Parameter} = _Message, Req, State) -> {reply, <<"OK">>, Req, State};
|
|
|
+info({update, _Target, _Elements} = _Message, Req, State) -> {reply, <<"OK">>, Req, State};
|
|
|
+info({insert_top, _Target, _Elements} = _Message, Req, State) -> {reply, <<"OK">>, Req, State};
|
|
|
+info({insert_bottom, _Target, _Elements} = _Message, Req, State) -> {reply, <<"OK">>, Req, State};
|
|
|
+
|
|
|
+
|
|
|
+% ASYNC protocol
|
|
|
+info({start, _Handler} = _Message, Req, State) -> {reply, <<"OK">>, Req, State};
|
|
|
+info({stop, _Name} = _Message, Req, State) -> {reply, <<"OK">>, Req, State};
|
|
|
+info({restart, _Name} = _Message, Req, State) -> {reply, <<"OK">>, Req, State};
|
|
|
+info({async, _Name, _Function} = _Message, Req, State) -> {reply, <<"OK">>, Req, State};
|
|
|
+info({flush} = _Message, Req, State) -> {reply, <<"OK">>, Req, State};
|
|
|
+
|
|
|
+info(Message, Req, State) -> {unknown, Message, Req, State}.
|
|
|
+
|