Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9002805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:37:11+00:00 2026-06-16T00:37:11+00:00

My app flow is as follows (simplified for clarity): User GETs a page from

  • 0

My app flow is as follows (simplified for clarity):

  1. User GETs a page from “/page1”
  2. User performs actions on the page (adds text, clicks, etc..), while Signalr communicates this data to the server, which performs heavy calculations in the background, and the results of those are returned to the page (lets call those “X”).
  3. When the user is finished with the page, he clicks a link to “/page2”, that is returned by Nancy. This page is built using a Model that is dependent on X.

So, how do I build that Model based on X? How can signalr write to the user session in a way that Nancy can pick up on?

(I’m looking for a “clean” way)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:37:12+00:00Added an answer on June 16, 2026 at 12:37 am

    Pending formal integration of Signalr & Nancy, this is what I came with. Basically, I share an IOC container between the two, and use an object (singleton lifetime) that maps users to state.

    How to share an IOC container using the built in TinyIOC:

    1. Extend Signalr’s DefaultDependencyResolver

      public class TinyIoCDependencyResolver : DefaultDependencyResolver
      {
          private readonly TinyIoCContainer m_Container;
      
          public TinyIoCDependencyResolver(TinyIoCContainer container)
          {
              m_Container = container;
          }
      
          public override object GetService(Type serviceType)
          {
              return m_Container.CanResolve(serviceType) ? m_Container.Resolve(serviceType) : base.GetService(serviceType);
          }
      
          public override IEnumerable<object> GetServices(Type serviceType)
          {
              var objects = m_Container.CanResolve(serviceType) ? m_Container.ResolveAll(serviceType) : new object[] { };
              return objects.Concat(base.GetServices(serviceType));
          }
      }
      
    2. Replace Signalr’s default DependencyResolver with our new one

      public class Bootstrapper : DefaultNancyBootstrapper
      {
          protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
          {
              CookieBasedSessions.Enable(pipelines);
      
              // Replace UserToStateMap with your class of choice
              container.Register<IUserToStateMap, UserToStateMap>();
      
              GlobalHost.DependencyResolver = new TinyIoCDependencyResolver(container);
              RouteTable.Routes.MapHubs();
          }
      }
      
    3. Add IUserToStateMap as a dependency in your hubs and Nancy modules

      public class MyModule : NancyModule
      {
          public MyModule(IUserToStateMap userToStateMap)
          {
              Get["/"] = o =>
              {
                  var userId = Session["userId"];
                  var state = userToStateMap[userId];
                  return state.Foo;
              };
          }
      }
      
      public class MyHub : Hub
      {
          private readonly IUserToStateMap m_UserToStateMap;
      
          public MyHub(IUserToStateMap userToStateMap)
          {
              m_UserToStateMap = userToStateMap;
          }
      
          public string MySignalrMethod(string userId)
          {
              var state = userToStateMap[userId];
              return state.Bar;
          }
      }
      

    What I would really want, is a way to easily share state between the two based on the connection ID or something like that, but in the meantime this solution works for me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following program flow: User fills in form My app generates a
I'm making an app which has a flow roughly as below: User starts on
I have a simple one page webapp that follows the the following flow of
I have an app in which the app flow is different from Android standard:
Currently doing a test-app with JCR (Modeshape). The abstracted flow is as follows: session.open,
How to logout from facebook app using oauth2 client flow? I failed to find
In my app I have a Save / Edit page. The current flow is
I have following flow of app : First screen is Login screen and if
In our Java EE app we are invoking the fb oauth flow to get
I'm in trouble with camera preview. But first, here's the flow of my app:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.