コード例 #1
0
        public async Task Subscribe(string channel)
        {
            await Groups.Add(Context.ConnectionId, channel);

            var ev = ChannelEvent.Subscribe(Context.ConnectionId, channel);

            await Publish(ev);
        }
コード例 #2
0
        public override Task OnDisconnected(bool stopCalled)
        {
            var ev = ChannelEvent.DisconnectedAdmin(Context.ConnectionId);

            Publish(ev);

            return(base.OnDisconnected(stopCalled));
        }
コード例 #3
0
        public override Task OnConnected()
        {
            var ev = ChannelEvent.ConnectedAdmin(Context.ConnectionId);

            Publish(ev);

            return(base.OnConnected());
        }
コード例 #4
0
 public Task Publish(ChannelEvent ev)
 {
     Clients.Group(ev.ChannelName).OnEvent(ev.Name, ev);
     return(Task.FromResult(0));
 }