Skip to content

Instantly share code, notes, and snippets.

View thecopy's full-sized avatar

Erik Jonsson Thorén thecopy

View GitHub Profile
public static class Bootstrapper
{
internal static IKernel Kernel = null;
internal static NinjectDependencyResolver NinjectDependencyResolver = null;
public static void StrapTheBoot()
{
var kernel = new StandardKernel();
kernel.Bind(typeof(IGenericRepository<>))
.To(typeof(GenericRepository<>))
// In Server
Console.WriteLine("Pinging " + item.Reciever.Name + "(" + connectionId + " ticket = " + item.Ticket + ")");
GlobalHost.ConnectionManager.GetHubContext<ZombieHub>().Clients.Client(connectionId)
.Ping(item.Ticket);
// In Client
_hubProxy.On<Guid>("Ping", OnPing);
// In Server
Console.WriteLine("Pinging " + item.Reciever.Name + "(" + connectionId + " ticket = " + item.Ticket + ")");
GlobalHost.ConnectionManager.GetHubContext<ZombieHub>().Clients.Client(connectionId)
.Ping(item.Ticket);
// In Client
_hubProxy.On<Guid>("Ping", OnPing);
_hubConnection = new HubConnection(url);
_hubProxy = _hubConnection.CreateHubProxy("ZombieHub");
_hubProxy.On<Guid>("Ping", OnPing);
_hubConnection.Start().Wait();
@thecopy
thecopy / gist:5462769
Created April 25, 2013 20:14
Im getting this on AppHarbor
Server Error in '/' Application.
Value cannot be null.
Parameter name: key
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: key
Enumerable.Range(0, range).ToList().ForEach(i =>
{
clients[i] = new ControllClient(LocalHostUrl);
clients[i].Connect();
if(!clients[i].LogOn("username", "password")) // <----------- Here a ConnectedClient is added!
throw new AssertionFailure("Could not log on user " + i);
});
var session = (ISession)Bootstrapper.Kernel.GetService(typeof(ISession));
var user = session.Get<ControllUser>(1);
Assert.AreEqual(50, user.ConnectedClients.Count); // FAILS!!
var options = new FormsAuthenticationOptions
{
AuthenticationMode = AuthenticationMode.Active,
CookieHttpOnly = true,
CookieName = "controll.auth.id",
CookiePath = "/",
CookieSecure = CookieSecureOption.Never,
ExpireTimeSpan = TimeSpan.FromMinutes(10),
ReturnUrlParameter = "ReturnUrl",
SlidingExpiration = true,
public class SessionHandlerPipelineModule : HubPipelineModule
{
private readonly ISession _session;
private ITransaction _transaction;
public SessionHandlerPipelineModule(ISession session)
{
_session = session;
}
@thecopy
thecopy / gist:5874375
Last active January 28, 2021 01:35
Quick way to test SignalR Hubs: http://i.imgur.com/aWnUrln.png
<html>
<head>
<title>SignalMan</title>
<script src="/Scripts/jquery-1.6.4.min.js"></script>
<script src="/Scripts/jquery.signalR-1.1.2.js"></script>
<script type="text/javascript">
window.signalman = { connected: false, hub: null, argumentCount: 0 };
$(function() {
public static class MessageCenterOwinExtensions
{
public static IAppBuilder UseMessageCenter(this IAppBuilder app, TinyIoCDependencyResolver resolver)
{
var queueDocumentStore = new EmbeddableDocumentStore
{
RunInMemory = true
};
queueDocumentStore.Initialize();