/// <summary> /// Creates a new WampSession by invoking the provided factory function then asynchronously connects /// </summary> /// <param name="url"></param> /// <param name="factoryFn"></param> /// <returns></returns> public static async Task<WampSession> ConnectAsync(string url, Func<IWampTransport> factoryFn) { var session = new WampSession(factoryFn()); await session.ConnectAsync(url); return session; }
public void Setup() { mockTransport = new MockWampTransport(); mockTransportFactory = new MockTransportFactory(mockTransport); var connectionTask = WampClient.ConnectAsync("ws://localhost:3000", mockTransportFactory); connectionTask.Wait(); this.connection = connectionTask.Result; }
/// <summary> /// Initializes a new WAMP session for provided client connection /// </summary> /// <param name="connection"></param> /// <returns></returns> protected virtual IWampSession InitializeWampSession(IWampConnection connection) { var session = new WampSession(connection); Sessions.AddSession(session); return(session); }