Esempio n. 1
0
        public void RemoveSubscription(Guid subscriptionId, Guid workspaceId, string callerId)
        {
            Subscription subscription = new Subscription(subscriptionId, workspaceId);

            MemberManager.RemoveSubscription(callerId, subscriptionId.ToString());
            ServerContextSingleton.Instance.ServerContext.RemoveSubscription(subscription);
        }
Esempio n. 2
0
        /// <summary>
        /// This handler is sending events to clients!
        /// </summary>
        /// <param name="sender">object that is sending event</param>
        /// <param name="e">data about event</param>
        public static void JSEventHandler(object sender, ObjectChangedEventArgs e)
        {
            var context = GlobalHost.ConnectionManager.GetHubContext <Event>();
            //finding user to which I need to send event
            string connectionId = MemberManager.FindConnection(e.Subscription.SubscriptionId.ToString());

            //sending event to specific user
            context.Clients[connectionId].sendEvent(e.ToJSON());
        }
Esempio n. 3
0
        public string CreateSubscription(Guid workspaceId, Guid instanceId, string propertyName, bool notifyChangesFromSameWorkspace, string callerId)//, EventHandler<Execom.IOG.Events.ObjectChangedEventArgs> del)
        {
            //EventHandler<Execom.IOG.Events.ObjectChangedEventArgs> delegate +=
            Subscription sub = null;

            if (propertyName == null)
            {
                sub = ServerContextSingleton.Instance.ServerContext.CreateSubscription(workspaceId, instanceId, notifyChangesFromSameWorkspace, JSEventHandler);
                MemberManager.AddSubscription(callerId, sub.SubscriptionId.ToString());
            }
            else
            {
                sub = ServerContextSingleton.Instance.ServerContext.CreateSubscription(workspaceId, instanceId, propertyName, notifyChangesFromSameWorkspace, JSEventHandler);
                MemberManager.AddSubscription(callerId, sub.SubscriptionId.ToString());
            }

            Dictionary <String, Subscription> result = new Dictionary <String, Subscription>();

            result.Add(RESULT, sub);
            return(result.ToJSON());
        }
Esempio n. 4
0
 public System.Threading.Tasks.Task Disconnect()
 {
     MemberManager.RemoveSubscription(Context.ConnectionId);
     return(Clients.leave(Context.ConnectionId, DateTime.Now.ToString()));
 }