def connect.tcp

bend-kit-websocket@0.4.0.0 · websocket.bend:912

import bend-kit-websocket@0.4.0.0/websocket.bend as Websocket
import Base
import bend-kit-wire@0.4.6.2/wire.bend as Wire

912def connect.tcp(c: Result<&1, &1, U32 & String, Socket>, +tls: Bool, +host: String, +authority: String, +path: String, +max: U32, +ms: U32) -> IO(Result<&1, &1, U32 & String, Conn>):
913  match c:
914    case Fail{e}:
915      do IO<Result<&1, &1, U32 & String, Conn>>:
916        return Fail{e}
917    case Done{sock}:
918      match tls:
919        case True{}:
920          do IO<Result<&1, &1, U32 & String, Conn>>:
921            t : Socket & Result<&1, &1, U32 & String, Unit> <- Wire.tls.connect(sock, host, ms)
922            connect.tls(t, authority, path, max, ms)
923        case False{}:
924          handshake(sock, False{}, authority, path, max, ms)

Uses (14)

Used by (1)