Browse Source

n2o_text to n4u_text

221V 3 years ago
parent
commit
e0135cd2bf
3 changed files with 20 additions and 14 deletions
  1. 1 1
      ebin/n4u.app
  2. 0 13
      src/protocols/n2o_text.erl
  3. 19 0
      src/protocols/n4u_text.erl

+ 1 - 1
ebin/n4u.app

@@ -2,7 +2,7 @@
   {description, "N4U WebSocket Application Server"},
   {vsn, "4.4.20"},
   {applications, [kernel, stdlib, asn1, public_key, ssl, crypto, ranch, cowboy, fs, active, sh, gproc, nitro]},
-  {modules, [n2o, n4u_app, n4u_sup, n4u_async, n2o_xhr, n4u_cx, n2o_cowboy, n2o_multipart, n2o_static, n2o_stream, n4u_document, n2o_proto, n2o_relay, n4u_error, n4u_io, n4u_log, n4u_mq, n2o_pickle, n2o_query, n2o_secret, n2o_session, n4u_syn, n4u_client, n2o_file, n4u_heart, n4u_http, n4u_nitrogen, n2o_text, wf, wf_convert, wf_utils]},
+  {modules, [n2o, n4u_app, n4u_sup, n4u_async, n2o_xhr, n4u_cx, n2o_cowboy, n2o_multipart, n2o_static, n2o_stream, n4u_document, n2o_proto, n2o_relay, n4u_error, n4u_io, n4u_log, n4u_mq, n2o_pickle, n2o_query, n2o_secret, n2o_session, n4u_syn, n4u_client, n2o_file, n4u_heart, n4u_http, n4u_nitrogen, n4u_text, wf, wf_convert, wf_utils]},
   {registered, [n4u_sup]},
   {mod, {n4u_app, []}},
   {env, []}

+ 0 - 13
src/protocols/n2o_text.erl

@@ -1,13 +0,0 @@
--module(n2o_text).
--include_lib("n4u/include/n4u.hrl").
--compile([export_all, nowarn_export_all]).
-
-info({text,Text}=Message, Req, State) when is_binary(Text) ->
-    wf:info(?MODULE,"TEXT Message: ~p",[Message]),
-    Module = State#cx.module,
-    Resp = try Module:event(Message) catch 
-    	E:R -> wf:error(?MODULE,"Catch: ~p:~p~n~p", wf:stack(E, R)), <<>> 
-    end,
-    {reply, Resp, Req, State};
-
-info(Message, Req, State) -> {unknown,Message, Req, State}.

+ 19 - 0
src/protocols/n4u_text.erl

@@ -0,0 +1,19 @@
+-module(n4u_text).
+-include_lib("n4u/include/n4u.hrl").
+
+-export([info/3]).
+
+
+info({text, Text} = Message, Req, State) when erlang:is_binary(Text) ->
+  wf:info(?MODULE, "TEXT Message: ~p", [Message]),
+  Module = State#cx.module,
+  Resp = try Module:event(Message)
+  catch E:R:Stk ->
+    wf:error(?MODULE, "Catch: ~p:~p~n~p", [E, R, Stk]),
+    <<"">>
+  end,
+  {reply, Resp, Req, State};
+
+
+info(Message, Req, State) -> {unknown, Message, Req, State}.
+