Skip to content

Instantly share code, notes, and snippets.

Per-Kristian Helland slashP

  • Oslo, Norway
Block or report user

Report or block slashP

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@slashP
slashP / gist:5108906
Created Mar 7, 2013
SignalR pirate chat
View gist:5108906
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 }));
}
}
@slashP
slashP / SignalR example
Created Mar 7, 2013
The simplest of SignalR
View SignalR example
public class TorrentHub : Hub
{
public void Ping(string message)
{
Clients.All.Ping(message);
}
public void UpdateTorrents(string json)
{
Clients.All.UpdateTorrents(json);
You can’t perform that action at this time.