This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ChatHub : Hub | |
{ | |
public void GetAll() | |
{ | |
using (var db = new DataContext()) | |
{ | |
var messages = db.ChatMessages.OrderByDescending(x => x.Id).Take(10).ToList(); | |
Clients.Caller.SendMessage(messages.Select(x => new { x.Message, x.User })); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TorrentHub : Hub | |
{ | |
public void Ping(string message) | |
{ | |
Clients.All.Ping(message); | |
} | |
public void UpdateTorrents(string json) | |
{ | |
Clients.All.UpdateTorrents(json); |