Module lasse_handler

Server-Sent Event handler for Cowboy.

Behaviours: cowboy_loop.

This module defines the lasse_handler behaviour.
Required callback functions: init/3, handle_notify/2, handle_info/2, handle_error/3, terminate/3.

Description

Server-Sent Event handler for Cowboy

Data Types

event()

event() = #{id => binary(), event => binary(), data => binary(), retry => binary(), comment | '' => binary()}

lasse_handler_options()

lasse_handler_options() = [module()] | #{module := module(), init_args => any()}

result()

result() = {send, Event::event(), NewState::any()} | {nosend, NewState::any()} | {stop, NewState::any()}

state()

state() = #state{module = module(), state = any()}

Function Index

info/3
init/2
notify/2
terminate/3

Function Details

info/3

info(Msg::term(), Req::cowboy_req:req(), State::state()) -> {ok | stop, cowboy_req:req(), state()}

init/2

init(Req::cowboy_req:req(), Opts::lasse_handler_options()) -> {atom(), cowboy_req:req(), state()}

notify/2

notify(Pid::atom() | pid(), Msg::term()) -> ok

terminate/3

terminate(Reason::term(), Req::cowboy_req:req(), State::state()) -> ok


Generated by EDoc