Last post Oct 12, 2013 06:01 AM by davidfowl
Oct 10, 2013 09:36 AM|dunkymole|LINK
I have an "hub adapter" class which listens to events from other sub-systems whereupon I am doing context.Clients.Client(event.SessionId). I based the pattern on the following:
In the implementation I statically resolved the context at construction (as the above suggests would be fine). In practice, however, I found messages were silently being lost. I could only correct this by resolving the context right before I need it. Can
someone confirm that this is the correct thing to do?
Oct 10, 2013 09:48 AM|dunkymole|LINK
In fact, this longer article:
states: "There are two reasons why you want to get the context just once: getting the context is an expensive operation, and getting it once ensures that the intended order of messages sent to clients is preserved."
From my observation, applying this technique breaks my app. Confused by this.
Oct 12, 2013 06:01 AM|davidfowl|LINK
You may not be experiencing message loss because of calling GetHubContext everytime you send. It might be that you're sending at a higher rate than the client can read. If that's not the case then you'd need to have more specific details about your app and
possibly a code that reproduces the same behavior in a new project so we can narrow down why you might be missing messages.