0

We are currently working on implementing a notifications feature for our app we are developing for Windows Azure. We want to inform users when actions have taken place they are interested in (such as the importing and exporting of files and so on). This notification is specific to each logged in user.

We have been using ServerSentEvents and we have found that this list is one event behind. So we do not start seeing notifications until the second action has taken place and that notification is for the first action. In our dev environments this problem always happens, but in Azure it appears to work as expected (sometimes!!!)

We are using the default implementation of the Event Queue and Channel Initialiser. We publish via the EventPublisher.WriteTo method passing a topic and a serverevent.

Here is our implementation of Topic:

public class UserNotificationsTopic : Topic
    {
        [RouteInput]
        public Guid UserId { get; set; }

        public override bool Equals(object obj)
        {
            return Equals(obj as UserNotificationsTopic);
        }

        public bool Equals(UserNotificationsTopic other)
        {
            if (ReferenceEquals(null, other)) return false;

            return ReferenceEquals(this, other) ||
                UserId.Equals(other.UserId);
        }

        public override int GetHashCode()
        {
            return UserId.GetHashCode();
        }
    }

Implementation of our ServerEvent:

public class UserNotificationServerEvent : IServerEvent
    {
        public string Id { get; private set; }

        public string Event { get; private set; }

        public int? Retry { get; set; }

        public object Data { get; private set; }

        public UserNotificationServerEvent(string id, string @event, object data)
        {
            this.Id = id;
            this.Event = @event;
            this.Data = data;
        }
    }

Any help, suggestions would be appreciated!

Thanks

Scott

4

1 回答 1

0

我想我已经找到了解决方案(在我同事的大力帮助下)。

我们阅读了有关 SignalR 的信息,发现它在 Azure 中存在类似问题(后面有一个事件),建议的解决方案是将 urlCompression 的属性添加到 Azure Web 角色的 Web.config。

我添加了 IIS7.5 的默认设置:

<urlCompression doStaticCompression="true" doDynamicCompression="false"/>

这似乎已经解决了这个问题!我还不确定为什么,所以如果有人可以提供帮助,请随时添加。

无论如何,我只是想我会分享更新。

于 2014-02-05T14:54:41.893 回答