The Plug.Conn.Adapter for MuroPlug.
The payload is one request on one Thousand Island socket. Response
framing is not decided here: every send_* call first asks the
book (hand in step.muro, through MuroPlug.Book.hand/2) which span
to write (2 buffered, 3 content-length pull, 4 chunked, 5
close-delimited) and whether the connection is kept. This module
then renders exactly that.
Request and response bodies are binaries or iodata of binaries. A body is never a list of octets.
upgrade/3 takes a :websocket upgrade (WebSock), see
MuroPlug.WebSocket.
Over TLS the same calls go through ThousandIsland.Transports.SSL.
send_file/6 uses ThousandIsland.Socket.sendfile/4, which is the
kernel's :file.sendfile on TCP and, on SSL, :file.pread of up to
1 MiB at a time written with :ssl.send, so a file body is the same
bytes on either transport.
Summary
Functions
Plug.Conn.upgrade_adapter(conn, :websocket, {websock, state, opts}),
the tuple WebSockAdapter.upgrade/4 passes to every server but Cowboy.
Types
Functions
Plug.Conn.upgrade_adapter(conn, :websocket, {websock, state, opts}),
the tuple WebSockAdapter.upgrade/4 passes to every server but Cowboy.
The request must be an RFC 6455 opening handshake
(MuroPlug.WebSocket.check/3); if not, this raises
MuroPlug.WebSocket.UpgradeError (400, or 426 for a version other
than 13). Bad option values raise ArgumentError before anything is
written. The spec is kept on the payload; after the Plug returns,
MuroPlug.Handler writes the 101 and runs the WebSocket on this
socket. Other protocols are {:error, :not_supported}.