public MessageClient AddSubscriber(string clientId, string endpointId, Subtopic subtopic, Selector selector) { lock(_objLock) { if (subtopic != null) { MessagingAdapter messagingAdapter = _messageDestination.ServiceAdapter as MessagingAdapter; if (messagingAdapter != null) { if (!messagingAdapter.AllowSubscribe(subtopic)) { ASObject aso = new ASObject(); aso["subtopic"] = subtopic.Value; throw new MessageException(aso); } } } if (!_subscribers.Contains(clientId)) { //Set in RtmpService MessageClient messageClient = new MessageClient(clientId, _messageDestination, endpointId); messageClient.Subtopic = subtopic; messageClient.Selector = selector; messageClient.AddSubscription(selector, subtopic); AddSubscriber(messageClient); messageClient.NotifyCreatedListeners(); return messageClient; } else { MessageClient messageClient = _subscribers[clientId] as MessageClient; IClient client = FluorineContext.Current.Client; if (client != null && !client.Id.Equals(messageClient.Client.Id)) { throw new MessageException("Duplicate subscriptions from multiple Flex Clients"); } //Reset the endpoint push state for the subscription to make sure its current because a resubscribe could be arriving over a new endpoint or a new session. messageClient.ResetEndpoint(endpointId); return messageClient; } } }