public IWampClientProxy <TMessage> Create(IWampConnection <TMessage> connection) { IWampOutgoingMessageHandler outgoingHandler = mOutgoingHandlerBuilder.Build(connection); WampConnectionMonitor <TMessage> monitor = new WampConnectionMonitor <TMessage>(connection); IDisposable disposable = new WampClientContainerDisposable <TMessage, IWampClientProxy <TMessage> > (mContainer, connection); WampClientProxy <TMessage> result = new WampClientProxy <TMessage>(outgoingHandler, mOutgoingSerializer, monitor, disposable); result.Session = (long)mContainer.GenerateClientId(result); result.Binding = mBinding; IDetailedWampConnection <TMessage> detailedConnection = connection as IDetailedWampConnection <TMessage>; if (detailedConnection != null) { result.TransportDetails = detailedConnection.TransportDetails; } monitor.Client = result; return(result); }
public IWampClient Create(IWampConnection <TMessage> connection) { WampOutgoingInterceptor <TMessage> wampOutgoingInterceptor = new WampOutgoingInterceptor <TMessage> (mOutgoingSerializer, mOutgoingHandlerBuilder.Build(connection)); ProxyGenerationOptions proxyGenerationOptions = new ProxyGenerationOptions() { Selector = new WampInterceptorSelector <TMessage>() }; proxyGenerationOptions.AddMixinInstance (new WampClientContainerDisposable <TMessage, IWampClient> (mContainer, connection)); // This is specific to WAMPv1. In WAMPv2 I think no curies // will be supported. proxyGenerationOptions.AddMixinInstance(new WampCurieMapper()); var monitor = new WampConnectionMonitor <TMessage>(connection); proxyGenerationOptions.AddMixinInstance(monitor); SessionIdPropertyInterceptor sessionIdPropertyInterceptor = new SessionIdPropertyInterceptor(); IWampClient result = mGenerator.CreateInterfaceProxyWithoutTarget <IWampClient> (proxyGenerationOptions, wampOutgoingInterceptor, sessionIdPropertyInterceptor, new WampCraAuthenticatorPropertyInterceptor()); monitor.Client = result; object sessiondId = mContainer.GenerateClientId(result); sessionIdPropertyInterceptor.SessionId = (string)sessiondId; return(result); }
public IWampClient Create(IWampConnection <TMessage> connection) { IWampOutgoingMessageHandler outgoingHandler = mOutgoingHandlerBuilder.Build(connection); WampConnectionMonitor <TMessage> monitor = new WampConnectionMonitor <TMessage>(connection); IDisposable disposable = new WampClientContainerDisposable <TMessage, IWampClient> (mContainer, connection); WampClientProxy result = new WampClientProxy(outgoingHandler, mOutgoingSerializer, monitor, disposable); result.SessionId = (string)mContainer.GenerateClientId(result); monitor.Client = result; return(result); }
public IWampClientProxy <TMessage> Create(IWampConnection <TMessage> connection) { IWampOutgoingMessageHandler outgoingHandler = mOutgoingHandlerBuilder.Build(connection); WampOutgoingInterceptor <TMessage> wampOutgoingInterceptor = new WampOutgoingInterceptor <TMessage> (mOutgoingSerializer, outgoingHandler); WampRawOutgoingInterceptor <TMessage> wampRawOutgoingInterceptor = new WampRawOutgoingInterceptor <TMessage>(outgoingHandler); ProxyGenerationOptions proxyGenerationOptions = new ProxyGenerationOptions() { Selector = new WampInterceptorSelector <TMessage>() }; WampConnectionMonitor <TMessage> monitor = new WampConnectionMonitor <TMessage>(connection); proxyGenerationOptions.AddMixinInstance(monitor); proxyGenerationOptions.AddMixinInstance (new WampClientContainerDisposable <TMessage, IWampClientProxy <TMessage> > (mContainer, connection)); WampTransportDetails transportDetails = null; if (connection is IDetailedWampConnection <TMessage> detailedConnection) { transportDetails = detailedConnection.TransportDetails; } WampClientPropertyBag <TMessage> propertyBag = new WampClientPropertyBag <TMessage>(mBinding, transportDetails); proxyGenerationOptions.AddMixinInstance(propertyBag); if (connection is IWampAuthenticatedConnection <TMessage> authenticatedConnection) { propertyBag.Authenticator = authenticatedConnection.Authenticator; } IWampClientProxy <TMessage> result = mGenerator.CreateInterfaceProxyWithoutTarget (typeof(IWampProxy), new[] { typeof(IWampClientProxy <TMessage>) }, proxyGenerationOptions, wampRawOutgoingInterceptor, wampOutgoingInterceptor) as IWampClientProxy <TMessage>; monitor.Client = result; long session = (long)mContainer.GenerateClientId(result); propertyBag.Session = session; return(result); }