Websocket.recv.closed: def of bend-kit-websocket@0.4.0.0 Import: import bend-kit-websocket@0.4.0.0/websocket.bend as Websocket Lines 1014-1026 of bend-kit-websocket@0.4.0.0/websocket.bend: https://jend.leeeet.dev/read.txt?path=bend-kit-websocket@0.4.0.0/websocket.bend&start_line=1014&end_line=1026 import Base import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes def recv.closed(r: Result<&1, &1, U32 & String, U32 & Bytes.Bytes>, sock: Socket, +tls: Bool, +server: Bool, rest: Bytes.Cursor, partial: Partial, +max: U32, closing: Bool) -> IO(Conn & Result<&1, &1, U32 & String, Incoming>): match r: case Fail{e}: recv.fail(sock, tls, server, max, e) case Done{(+code, reason)}: match closing: case True{}: recv.out(sock, tls, server, rest, partial, max, True{}, Done{Closed{code, reason}}) case False{}: echo = Bool.pick(Bytes.Bytes, U32.is_eq(code, 1005), Bytes.new(0), close.payload(code, Bytes.new(0))) do IO>: s : Socket & Result<&1, &1, U32 & String, Unit> <- raw(server, sock, tls, True{}, 8, echo) recv.echoed(s, tls, server, rest, partial, max, code, reason) Uses (23): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.pick https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO.bind https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Pair https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Result https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Sigma https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Socket https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_eq https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Unit https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=Bytes https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=Cursor https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=new https://jend.leeeet.dev/definition.txt?path=bend-kit-websocket@0.4.0.0/websocket.bend&name=Conn https://jend.leeeet.dev/definition.txt?path=bend-kit-websocket@0.4.0.0/websocket.bend&name=Incoming https://jend.leeeet.dev/definition.txt?path=bend-kit-websocket@0.4.0.0/websocket.bend&name=Partial https://jend.leeeet.dev/definition.txt?path=bend-kit-websocket@0.4.0.0/websocket.bend&name=close.payload https://jend.leeeet.dev/definition.txt?path=bend-kit-websocket@0.4.0.0/websocket.bend&name=raw https://jend.leeeet.dev/definition.txt?path=bend-kit-websocket@0.4.0.0/websocket.bend&name=recv.echoed https://jend.leeeet.dev/definition.txt?path=bend-kit-websocket@0.4.0.0/websocket.bend&name=recv.fail https://jend.leeeet.dev/definition.txt?path=bend-kit-websocket@0.4.0.0/websocket.bend&name=recv.out