25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-06 15:37:52 +01:00
xmpp.chapril.org-ejabberd/src/web/websocket_test.erl

19 lines
312 B
Erlang
Raw Normal View History

-module (websocket_test).
-export([start/1, loop/1]).
% callback on received websockets data
start(Ws) ->
spawn(?MODULE, loop, [Ws]).
loop(Ws) ->
receive
{browser, Data} ->
Ws:send(["received '", Data, "'"]),
loop(Ws);
_Ignore ->
loop(Ws)
after 5000 ->
Ws:send("pushing!"),
loop(Ws)
end.