Exemplo n.º 1
0
		public virtual void Push(IMessage message, MessageClient messageClient)
		{
			throw new NotSupportedException();
		}
Exemplo n.º 2
0
		public override void Push(IMessage message, MessageClient messageClient)
		{
            /*
            IMessageConnection messageConnection = messageClient.MessageConnection;
            Debug.Assert(messageConnection != null);
            if (messageConnection != null)
                messageConnection.Push(message, messageClient);
            */
            ISession session = messageClient.Session;
            System.Diagnostics.Debug.Assert(session != null);
            session.Push(message, messageClient);
		}
Exemplo n.º 3
0
 public override void Push(IMessage message, MessageClient messageClient)
 {
     IEndpointPushHandler handler = messageClient.Client.GetEndpointPushHandler(this.Id);
     if (handler != null)
     {
         IMessage messageClone = message.Copy() as IMessage;
         messageClone.SetHeader(MessageBase.DestinationClientIdHeader, messageClient.ClientId);
         messageClone.clientId = messageClient.ClientId;
         handler.PushMessage(messageClone);
     }
     /*
     IMessage messageClone = message.Clone() as IMessage;
     messageClone.SetHeader(MessageBase.DestinationClientIdHeader, messageClient.ClientId);
     messageClone.clientId = messageClient.ClientId;
     messageClient.AddMessage(messageClone);
     */
 }
Exemplo n.º 4
0
 public override void Push(IMessage message, MessageClient messageClient)
 {
     if (this.ChannelDefinition.Properties.IsPollingEnabled)
     {
         IEndpointPushHandler handler = messageClient.Client.GetEndpointPushHandler(this.Id);
         if (handler != null)
         {
             IMessage messageClone = message.Copy() as IMessage;
             messageClone.SetHeader(MessageBase.DestinationClientIdHeader, messageClient.ClientId);
             messageClone.clientId = messageClient.ClientId;
             handler.PushMessage(messageClone);
         }
         /*
         IMessage messageClone = message.Clone() as IMessage;
         messageClone.SetHeader(MessageBase.DestinationClientIdHeader, messageClient.ClientId);
         messageClone.clientId = messageClient.ClientId;
         messageClient.AddMessage(messageClone);
         */
     }
     else
     {
         if (log.IsWarnEnabled)
             log.Warn("Push request received for the non-polling AMF endpoint '" + this.Id + "'");
     }
 }
Exemplo n.º 5
0
        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;
                }
			}
		}
Exemplo n.º 6
0
 public void CancelTimeout(MessageClient messageClient)
 {
     lock (_objLock)
     {
         HttpRuntime.Cache.Remove(messageClient.ClientId);
     }
 }
Exemplo n.º 7
0
		public MessageClient RemoveSubscriber(MessageClient messageClient)
		{
			if( log.IsDebugEnabled )
				log.Debug(__Res.GetString(__Res.SubscriptionManager_Remove, messageClient.ClientId));

			lock(_objLock)
			{
				RemoveSubscriber(messageClient.ClientId);
				return messageClient;
			}
		}
Exemplo n.º 8
0
		private void AddSubscriber(MessageClient messageClient)
		{
            lock (_objLock)
            {
                if (!_subscribers.Contains(messageClient.ClientId))
                {
                    _subscribers[messageClient.ClientId] = messageClient;
                    // Add the MessageClient to the Cache with the expiration item
                    int timeOutMinutes = 20;
                    if (_messageDestination.DestinationDefinition.Properties.Network != null)
                        timeOutMinutes = _messageDestination.DestinationDefinition.Properties.Network.SessionTimeout;


                    HttpRuntime.Cache.Insert(messageClient.ClientId, messageClient, null,
                        Cache.NoAbsoluteExpiration,
                        new TimeSpan(0, timeOutMinutes, 0),
                        CacheItemPriority.NotRemovable, new CacheItemRemovedCallback(this.RemovedCallback));

                    /*
                    HttpRuntime.Cache.Insert( messageClient.ClientId, messageClient, null, 
                        DateTime.Now.AddSeconds(timeOutMinutes),
                        TimeSpan.Zero,
                        CacheItemPriority.Default, new CacheItemRemovedCallback(this.RemovedCallback) );
                    */
                }
            }
		}