Beispiel #1
0
 public SignalrStarter(MyContext context)
 {
     this.context = context;
     connection   = new Connection("http://localhost/api/messagestream")
     {
         JsonSerializer = JsonSerializer.Create(SerializationSettingsFactoryForSignalR.CreateDefault())
     };
 }
Beispiel #2
0
        public void Should_be_imported_and_accessible_via_the_rest_api()
        {
            var context = new MyContext();

            Define(context)
            .WithEndpoint <ManagementEndpointEx>(b => b.AppConfig(PathToAppConfig)
                                                 .When(_ =>
            {
                var connection = new Connection("http://*****:*****@"{ 
type: 'ArchiveMessage',
message: {failed_message_id: 'John'}
}";
                connection.Send(data);
                connection.Stop();
            }))
            .Done(c => c.MessageReceived)
            .Run();

            Assert.AreEqual("John", context.Name);
        }
Beispiel #3
0
        private void ConfigureSignalR(IAppBuilder app)
        {
            var resolver = new AutofacDependencyResolver(container);

            app.Map("/messagestream", map =>
            {
                map.UseCors(CorsOptions.AllowAll);
                map.RunSignalR <MessageStreamerConnection>(
                    new ConnectionConfiguration
                {
                    EnableJSONP = true,
                    Resolver    = resolver
                });
            });

            GlobalHost.DependencyResolver = resolver;

            var jsonSerializer = JsonSerializer.Create(SerializationSettingsFactoryForSignalR.CreateDefault());

            GlobalHost.DependencyResolver.Register(typeof(JsonSerializer), () => jsonSerializer);
        }