ws_handler behaviour (ws v0.3.0)
View SourceUser handler behaviour. The session dispatches inbound messages and out-of-band Erlang messages to the callback module supplied at ws:accept/5 / ws:connect/2 time.
All callbacks return one of: {ok, State} — continue, no outbound frames. {reply, Frames, State} — continue, send Frames (list). {stop, Reason, State} — tear the session down.
Frames is a single frame or a list of frames in the shape accepted by ws_frame:encode/2. The session auto-responds to ping frames with a matching pong *before* invoking handle_in/2, so handlers do not need to do so themselves unless they want custom behaviour.
Summary
Types
-type frame() :: ws_frame:frame().