ws_transport behaviour (ws v0.3.0)
View SourceTransport behaviour — a thin abstraction the session uses to exchange bytes on the stream handle supplied by the embedder.
Inbound bytes reach the session as plain Erlang messages; the transport module is responsible for turning adapter-specific messages ({tcp, ...}, {ssl, ...}, {h2_stream, ...}) into the canonical shapes below:
{ws_data, Handle, Bin} {ws_closed, Handle} {ws_error, Handle, Reason}
The session calls activate/1 when it wants the next batch of bytes. Transports that deliver continuously (e.g. ssl in active, true mode) may simply return ok.
Summary
Callbacks
-callback close(Handle :: term()) -> ok.
-callback peername(Handle :: term()) -> {ok, {inet:ip_address(), inet:port_number()}} | {error, term()}.