using SignalR.Hubs;
using System.Collections.Generic;
using System.Linq;

namespace Mvc3SignalR.Models
{
    public class Chat : Hub
    {
        static List<string> messages = new List<string>();

        public void Send(string message)
        {
            messages.Add(message);
            var results = (from m in messages
                           select m).Reverse().Take(5);

            // Call the addMessage method on all clients
            Clients.addMessage(results);
        }
    }
}