MemoryServerEvents
Assembly: ServiceStack.dll
Declaration
public class MemoryServerEvents : IServerEvents, IDisposable
Properties
IdleTimeout
Declaration
public TimeSpan IdleTimeout { get; set; }
HouseKeepingInterval
Declaration
public TimeSpan HouseKeepingInterval { get; set; }
OnSubscribeAsync
Declaration
public Func<IEventSubscription, Task> OnSubscribeAsync { get; set; }
OnUnsubscribeAsync
Declaration
public Func<IEventSubscription, Task> OnUnsubscribeAsync { get; set; }
OnUpdateAsync
Declaration
public Func<IEventSubscription, Task> OnUpdateAsync { get; set; }
OnRemoveSubscriptionAsync
Declaration
public Func<IEventSubscription, Task> OnRemoveSubscriptionAsync { get; set; }
NotifyJoinAsync
Declaration
public Func<IEventSubscription, Task> NotifyJoinAsync { get; set; }
NotifyLeaveAsync
Declaration
public Func<IEventSubscription, Task> NotifyLeaveAsync { get; set; }
NotifyUpdateAsync
Declaration
public Func<IEventSubscription, Task> NotifyUpdateAsync { get; set; }
NotifyHeartbeatAsync
Declaration
public Func<IEventSubscription, Task> NotifyHeartbeatAsync { get; set; }
Serialize
Declaration
public Func<object, string> Serialize { get; set; }
NotifyChannelOfSubscriptions
Declaration
public bool NotifyChannelOfSubscriptions { get; set; }
OnError
Declaration
public Action<IEventSubscription, Exception> OnError { get; set; }
Fields
FlushNopOnSubscription
Declaration
public static bool FlushNopOnSubscription
Subscriptions
Declaration
public ConcurrentDictionary<string, IEventSubscription> Subscriptions
ChannelSubscriptions
Declaration
public ConcurrentDictionary<string, ConcurrentDictionary<IEventSubscription, bool>> ChannelSubscriptions
UserIdSubscriptions
Declaration
public ConcurrentDictionary<string, ConcurrentDictionary<IEventSubscription, bool>> UserIdSubscriptions
UserNameSubscriptions
Declaration
public ConcurrentDictionary<string, ConcurrentDictionary<IEventSubscription, bool>> UserNameSubscriptions
SessionSubscriptions
Declaration
public ConcurrentDictionary<string, ConcurrentDictionary<IEventSubscription, bool>> SessionSubscriptions
Methods
Reset()
Start()
Stop()
StopAsync()
Declaration
public async Task StopAsync()
Returns
System.Threading.Tasks.Task
NotifyAll(String, Object)
Declaration
public void NotifyAll(string selector, object message)
Parameters
Type | Name |
---|
System.String | selector |
System.Object | message |
NotifyAllAsync(String, Object, CancellationToken)
Declaration
public async Task NotifyAllAsync(string selector, object message, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|
System.String | selector |
System.Object | message |
System.Threading.CancellationToken | token |
NotifyAllJsonAsync(String, String, CancellationToken)
Declaration
public async Task NotifyAllJsonAsync(string selector, string json, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|
System.String | selector |
System.String | json |
System.Threading.CancellationToken | token |
NotifyChannelsAsync(String[], String, String, CancellationToken)
Declaration
public async Task NotifyChannelsAsync(string[] channels, string selector, string body, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|
System.String[] | channels |
System.String | selector |
System.String | body |
System.Threading.CancellationToken | token |
NotifySubscription(String, String, Object, String)
Declaration
public void NotifySubscription(string subscriptionId, string selector, object message, string channel = null)
Parameters
Type | Name |
---|
System.String | subscriptionId |
System.String | selector |
System.Object | message |
System.String | channel |
NotifySubscriptionAsync(String, String, Object, String, CancellationToken)
Declaration
public Task NotifySubscriptionAsync(string subscriptionId, string selector, object message, string channel = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|
System.String | subscriptionId |
System.String | selector |
System.Object | message |
System.String | channel |
System.Threading.CancellationToken | token |
NotifySubscriptionJsonAsync(String, String, String, String, CancellationToken)
Declaration
public Task NotifySubscriptionJsonAsync(string subscriptionId, string selector, string json, string channel = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|
System.String | subscriptionId |
System.String | selector |
System.String | json |
System.String | channel |
System.Threading.CancellationToken | token |
NotifyChannel(String, String, Object)
Declaration
public void NotifyChannel(string channel, string selector, object message)
Parameters
Type | Name |
---|
System.String | channel |
System.String | selector |
System.Object | message |
NotifyChannelAsync(String, String, Object, CancellationToken)
Declaration
public Task NotifyChannelAsync(string channel, string selector, object message, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|
System.String | channel |
System.String | selector |
System.Object | message |
System.Threading.CancellationToken | token |
NotifyChannelJsonAsync(String, String, String, CancellationToken)
Declaration
public Task NotifyChannelJsonAsync(string channel, string selector, string json, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|
System.String | channel |
System.String | selector |
System.String | json |
System.Threading.CancellationToken | token |
NotifyUserId(String, String, Object, String)
Declaration
public void NotifyUserId(string userId, string selector, object message, string channel = null)
Parameters
Type | Name |
---|
System.String | userId |
System.String | selector |
System.Object | message |
System.String | channel |
NotifyUserIdAsync(String, String, Object, String, CancellationToken)
Declaration
public Task NotifyUserIdAsync(string userId, string selector, object message, string channel = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|
System.String | userId |
System.String | selector |
System.Object | message |
System.String | channel |
System.Threading.CancellationToken | token |
NotifyUserIdJsonAsync(String, String, String, String, CancellationToken)
Declaration
public Task NotifyUserIdJsonAsync(string userId, string selector, string json, string channel = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|
System.String | userId |
System.String | selector |
System.String | json |
System.String | channel |
System.Threading.CancellationToken | token |
NotifyUserName(String, String, Object, String)
Declaration
public void NotifyUserName(string userName, string selector, object message, string channel = null)
Parameters
Type | Name |
---|
System.String | userName |
System.String | selector |
System.Object | message |
System.String | channel |
NotifyUserNameAsync(String, String, Object, String, CancellationToken)
Declaration
public Task NotifyUserNameAsync(string userName, string selector, object message, string channel = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|
System.String | userName |
System.String | selector |
System.Object | message |
System.String | channel |
System.Threading.CancellationToken | token |
NotifyUserNameJsonAsync(String, String, String, String, CancellationToken)
Declaration
public Task NotifyUserNameJsonAsync(string userName, string selector, string json, string channel = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|
System.String | userName |
System.String | selector |
System.String | json |
System.String | channel |
System.Threading.CancellationToken | token |
NotifySession(String, String, Object, String)
Declaration
public void NotifySession(string sessionId, string selector, object message, string channel = null)
Parameters
Type | Name |
---|
System.String | sessionId |
System.String | selector |
System.Object | message |
System.String | channel |
NotifySessionAsync(String, String, Object, String, CancellationToken)
Declaration
public Task NotifySessionAsync(string sessionId, string selector, object message, string channel = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|
System.String | sessionId |
System.String | selector |
System.Object | message |
System.String | channel |
System.Threading.CancellationToken | token |
NotifySessionJsonAsync(String, String, String, String, CancellationToken)
Declaration
public Task NotifySessionJsonAsync(string sessionId, string selector, string json, string channel = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|
System.String | sessionId |
System.String | selector |
System.String | json |
System.String | channel |
System.Threading.CancellationToken | token |
GetStats()
Declaration
public Dictionary<string, string> GetStats()
Returns
System.Collections.Generic.Dictionary<System.String,System.String>
RegisterHungConnection(IEventSubscription)
Declaration
public void RegisterHungConnection(IEventSubscription sub)
Parameters
QueueAsyncTask(Func<Task>)
Declaration
public void QueueAsyncTask(Func<Task> task)
Parameters
Type | Name |
---|
System.Func<System.Threading.Tasks.Task> | task |
GetMemoryServerEvents()
Declaration
public MemoryServerEvents GetMemoryServerEvents()
Returns
ServiceStack.MemoryServerEvents
NotifyRaw(ConcurrentDictionary<String, ConcurrentDictionary<IEventSubscription, Boolean>>, String, String, String, String)
Declaration
protected void NotifyRaw(ConcurrentDictionary<string, ConcurrentDictionary<IEventSubscription, bool>> map, string key, string selector, string body, string channel = null)
Parameters
Type | Name |
---|
System.Collections.Concurrent.ConcurrentDictionary<System.String,System.Collections.Concurrent.ConcurrentDictionary<ServiceStack.IEventSubscription,System.Boolean>> | map |
System.String | key |
System.String | selector |
System.String | body |
System.String | channel |
Notify(ConcurrentDictionary<String, ConcurrentDictionary<IEventSubscription, Boolean>>, String, String, Object, String)
Declaration
protected void Notify(ConcurrentDictionary<string, ConcurrentDictionary<IEventSubscription, bool>> map, string key, string selector, object message, string channel = null)
Parameters
Type | Name |
---|
System.Collections.Concurrent.ConcurrentDictionary<System.String,System.Collections.Concurrent.ConcurrentDictionary<ServiceStack.IEventSubscription,System.Boolean>> | map |
System.String | key |
System.String | selector |
System.Object | message |
System.String | channel |
Notify(ConcurrentDictionary<String, IEventSubscription>, String, String, Object, String)
Declaration
protected void Notify(ConcurrentDictionary<string, IEventSubscription> map, string key, string selector, object message, string channel = null)
Parameters
Type | Name |
---|
System.Collections.Concurrent.ConcurrentDictionary<System.String,ServiceStack.IEventSubscription> | map |
System.String | key |
System.String | selector |
System.Object | message |
System.String | channel |
NotifyRawAsync(ConcurrentDictionary<String, ConcurrentDictionary<IEventSubscription, Boolean>>, String, String, String, String, CancellationToken)
Declaration
protected async Task NotifyRawAsync(ConcurrentDictionary<string, ConcurrentDictionary<IEventSubscription, bool>> map, string key, string selector, string body, string channel = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|
System.Collections.Concurrent.ConcurrentDictionary<System.String,System.Collections.Concurrent.ConcurrentDictionary<ServiceStack.IEventSubscription,System.Boolean>> | map |
System.String | key |
System.String | selector |
System.String | body |
System.String | channel |
System.Threading.CancellationToken | token |
NotifyAsync(ConcurrentDictionary<String, ConcurrentDictionary<IEventSubscription, Boolean>>, String, String, Object, String, CancellationToken)
Declaration
protected Task NotifyAsync(ConcurrentDictionary<string, ConcurrentDictionary<IEventSubscription, bool>> map, string key, string selector, object message, string channel = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|
System.Collections.Concurrent.ConcurrentDictionary<System.String,System.Collections.Concurrent.ConcurrentDictionary<ServiceStack.IEventSubscription,System.Boolean>> | map |
System.String | key |
System.String | selector |
System.Object | message |
System.String | channel |
System.Threading.CancellationToken | token |
NotifyRawAsync(ConcurrentDictionary<String, IEventSubscription>, String, String, String, String, CancellationToken)
Declaration
protected async Task NotifyRawAsync(ConcurrentDictionary<string, IEventSubscription> map, string key, string selector, string body, string channel = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|
System.Collections.Concurrent.ConcurrentDictionary<System.String,ServiceStack.IEventSubscription> | map |
System.String | key |
System.String | selector |
System.String | body |
System.String | channel |
System.Threading.CancellationToken | token |
NotifyAsync(ConcurrentDictionary<String, IEventSubscription>, String, String, Object, String, CancellationToken)
Declaration
protected Task NotifyAsync(ConcurrentDictionary<string, IEventSubscription> map, string key, string selector, object message, string channel = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|
System.Collections.Concurrent.ConcurrentDictionary<System.String,ServiceStack.IEventSubscription> | map |
System.String | key |
System.String | selector |
System.Object | message |
System.String | channel |
System.Threading.CancellationToken | token |
FlushNopAsync(ConcurrentDictionary<String, ConcurrentDictionary<IEventSubscription, Boolean>>, String, String, CancellationToken)
Declaration
protected async Task FlushNopAsync(ConcurrentDictionary<string, ConcurrentDictionary<IEventSubscription, bool>> map, string key, string channel = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|
System.Collections.Concurrent.ConcurrentDictionary<System.String,System.Collections.Concurrent.ConcurrentDictionary<ServiceStack.IEventSubscription,System.Boolean>> | map |
System.String | key |
System.String | channel |
System.Threading.CancellationToken | token |
Pulse(String)
Declaration
public bool Pulse(string id)
Returns
System.Boolean
Parameters
PulseAsync(String, CancellationToken)
Declaration
public async Task<bool> PulseAsync(string id, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.Boolean>
Parameters
Type | Name |
---|
System.String | id |
System.Threading.CancellationToken | token |
GetSubscription(String)
Declaration
public IEventSubscription GetSubscription(string id)
Returns
ServiceStack.IEventSubscription
Parameters
GetSubscriptionInfo(String)
Declaration
public SubscriptionInfo GetSubscriptionInfo(string id)
Returns
ServiceStack.SubscriptionInfo
Parameters
GetSubscriptionInfosByUserId(String)
Declaration
public List<SubscriptionInfo> GetSubscriptionInfosByUserId(string userId)
Returns
System.Collections.Generic.List<ServiceStack.SubscriptionInfo>
Parameters
Type | Name |
---|
System.String | userId |
GetNextSequence(String)
Declaration
public long GetNextSequence(string sequenceId)
Returns
System.Int64
Parameters
Type | Name |
---|
System.String | sequenceId |
RemoveExpiredSubscriptions()
Declaration
public int RemoveExpiredSubscriptions()
Returns
System.Int32
RemoveExpiredSubscriptionsAsync(CancellationToken)
Declaration
public async Task<int> RemoveExpiredSubscriptionsAsync(CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.Int32>
Parameters
Type | Name |
---|
System.Threading.CancellationToken | token |
SubscribeToChannels(String, String[])
Declaration
public void SubscribeToChannels(string subscriptionId, string[] channels)
Parameters
Type | Name |
---|
System.String | subscriptionId |
System.String[] | channels |
SubscribeToChannelsAsync(String, String[], CancellationToken)
Declaration
public Task SubscribeToChannelsAsync(string subscriptionId, string[] channels, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|
System.String | subscriptionId |
System.String[] | channels |
System.Threading.CancellationToken | token |
UnsubscribeFromChannels(String, String[])
Declaration
public void UnsubscribeFromChannels(string subscriptionId, string[] channels)
Parameters
Type | Name |
---|
System.String | subscriptionId |
System.String[] | channels |
UnsubscribeFromChannelsAsync(String, String[], CancellationToken)
Declaration
public Task UnsubscribeFromChannelsAsync(string subscriptionId, string[] channels, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|
System.String | subscriptionId |
System.String[] | channels |
System.Threading.CancellationToken | token |
GetSubscriptionsDetails(String[])
Declaration
public List<Dictionary<string, string>> GetSubscriptionsDetails(params string[] channels)
Returns
System.Collections.Generic.List<System.Collections.Generic.Dictionary<System.String,System.String>>
Parameters
Type | Name |
---|
System.String[] | channels |
GetAllSubscriptionsDetails()
Declaration
public List<Dictionary<string, string>> GetAllSubscriptionsDetails()
Returns
System.Collections.Generic.List<System.Collections.Generic.Dictionary<System.String,System.String>>
GetAllSubscriptionInfos()
Declaration
public List<SubscriptionInfo> GetAllSubscriptionInfos()
Returns
System.Collections.Generic.List<ServiceStack.SubscriptionInfo>
RegisterAsync(IEventSubscription, Dictionary<String, String>, CancellationToken)
Declaration
public async Task RegisterAsync(IEventSubscription subscription, Dictionary<string, string> connectArgs = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|
ServiceStack.IEventSubscription | subscription |
System.Collections.Generic.Dictionary<System.String,System.String> | connectArgs |
System.Threading.CancellationToken | token |
FlushNopToChannelsAsync(String[], CancellationToken)
Declaration
public async Task FlushNopToChannelsAsync(string[] channels, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|
System.String[] | channels |
System.Threading.CancellationToken | token |
UnRegister(String, CancellationToken)
Declaration
public void UnRegister(string subscriptionId, CancellationToken token = default(CancellationToken))
Parameters
Type | Name |
---|
System.String | subscriptionId |
System.Threading.CancellationToken | token |
UnRegisterAsync(String, CancellationToken)
Declaration
public Task UnRegisterAsync(string subscriptionId, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|
System.String | subscriptionId |
System.Threading.CancellationToken | token |
DisposeAsync()
Declaration
public async Task DisposeAsync()
Returns
System.Threading.Tasks.Task
Dispose()
Implements