public static async Task <TgBellhop> Connect( ConnectInfo connectInfo, TgCallMiddlewareChain?callMiddlewareChain = null, TcpClientConnectionHandler?connHandler = null ) { callMiddlewareChain ??= TgCallMiddlewareChain.Default; var conn = await TaskWrapper.Wrap(() => TgConnectionEstablisher.EstablishConnection(connectInfo, callMiddlewareChain, connHandler) ).ConfigureAwait(false); var pool = new TgConnectionPool(conn, callMiddlewareChain, connHandler); return(new TgBellhop(pool, conn)); }
public TgBellhop(Some <TgConnectionPool> connectionPool, Some <TgConnection> currentConnection) { ConnectionPool = connectionPool; CurrentConnection = currentConnection.Value.AsVar(); MirrorUpdates(currentConnection); }