ws_send_many.erl 418 B

1234567891011121314151617
  1. %% Feel free to use, reuse and abuse the code in this file.
  2. -module(ws_send_many).
  3. -export([init/2]).
  4. -export([websocket_handle/3]).
  5. -export([websocket_info/3]).
  6. init(Req, Opts) ->
  7. erlang:send_after(10, self(), send_many),
  8. {cowboy_websocket, Req, Opts}.
  9. websocket_handle(_Frame, Req, State) ->
  10. {ok, Req, State}.
  11. websocket_info(send_many, Req, State = [{sequence, Sequence}]) ->
  12. {reply, Sequence, Req, State}.