livery_ws_h2 (livery v0.2.0)

View Source

ws_transport implementation over an HTTP/2 stream.

After an extended-CONNECT WebSocket handshake (RFC 8441), the WS session exchanges frames as HTTP/2 DATA on the same stream. This module maps the ws_transport callbacks onto the h2 library:

The handle is {Conn, StreamId}.

Summary

Types

handle()

-type handle() :: {h2:connection(), h2:stream_id()}.

Functions

activate(Handle)

-spec activate(handle()) -> ok.

classify/2

-spec classify(term(), handle()) ->
                  {ws_data, handle(), binary()} |
                  {ws_closed, handle()} |
                  {ws_error, handle(), term()} |
                  ignore.

close/1

-spec close(handle()) -> ok.

controlling_process/2

-spec controlling_process(handle(), pid()) -> ok | {error, term()}.

peername(Handle)

-spec peername(handle()) -> {error, not_supported}.

send/2

-spec send(handle(), iodata()) -> ok | {error, term()}.