2012-10-11 21:46:43 +02:00
|
|
|
%% Feel free to use, reuse and abuse the code in this file.
|
|
|
|
|
2013-04-22 15:55:22 +02:00
|
|
|
-module(ws_send_many).
|
2012-10-11 21:46:43 +02:00
|
|
|
|
2014-09-26 15:58:44 +03:00
|
|
|
-export([init/2]).
|
2012-10-11 21:46:43 +02:00
|
|
|
-export([websocket_handle/3]).
|
|
|
|
-export([websocket_info/3]).
|
|
|
|
|
2014-09-26 15:58:44 +03:00
|
|
|
init(Req, Opts) ->
|
2012-10-11 21:46:43 +02:00
|
|
|
erlang:send_after(10, self(), send_many),
|
2014-09-30 20:12:13 +03:00
|
|
|
{cowboy_websocket, Req, Opts}.
|
2012-10-11 21:46:43 +02:00
|
|
|
|
|
|
|
websocket_handle(_Frame, Req, State) ->
|
|
|
|
{ok, Req, State}.
|
|
|
|
|
2012-12-02 21:37:24 +01:00
|
|
|
websocket_info(send_many, Req, State = [{sequence, Sequence}]) ->
|
|
|
|
{reply, Sequence, Req, State}.
|