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); }
public WampClientPropertyBag(IWampBinding <TMessage> binding, WampTransportDetails transportDetails) { Binding = binding; mTransportDetails = transportDetails; }