n2o_http.erl 585 B

123456789101112131415
  1. -module(n2o_http).
  2. -include_lib("n2o/include/wf.hrl").
  3. -compile([export_all, nowarn_export_all]).
  4. %% ws.send(enc(tuple(atom('http'), bin(url), bin(method), bin(body), [])));
  5. info(#http{} = Message, Req, State) ->
  6. wf:info(?MODULE, "Http Message: ~p",[Message]),
  7. Module = State#cx.module,
  8. Reply = try Module:event(Message)
  9. catch E:R -> Error = wf:stack(E,R), wf:error(?MODULE,"Catch: ~p:~p~n~p",Error), Error end,
  10. {reply,wf:format({io,n2o_nitrogen:render_actions(wf:actions()),Reply}),Req,State};
  11. info(Message, Req, State) -> {unknown,Message, Req, State}.