SignalR/SignalR — Issue #199: dynamic methods of Caller are not always read by Client javascript
Author: pr1ntr
Created: 2012-02-17 19:24:56+00:00
State: open

I have a user initiated method where the user submits an answer for some trivia. This method is getting called on the MVC 3 side but when it fires off Caller.updateUser(bool) it only works sporadically.

Since I needed a solution that can scale azure role instances, I have the webroles run on a timer interval of 1000ms to push updates to the connected users. I am not sure if this may interfere with the Caller running methods.

some code:

this runs once a second:
public static void UpdateGame(GameState state)
{
try
{

IConnectionManager connectionManager = AspNetHost.DependencyResolver.Resolve();
var triviaClient = connectionManager.GetClients();
triviaClient.update(state);

}
catch (Exception ex)
{
TriviaUserHub.HandleException(ex);
}

}

this is the method with the Caller.updateUser() method:

public void SubmitAnswer(int id, string userName)
{
try
{

var model = new MessageModel();
model.Type = MessageType.Submit;

GameState state = UserCacheConnector.RetrieveGameState();

model.Correct = EvaluateAnswer(state.Answers, id);
var currentUser = UserTableClient.GetUser(userName);
model.CurrentUser = userName;

var caller = Caller.updateUser(model.Correct);

BrokeredMessage message = new BrokeredMessage(model);
message.TimeToLive = new TimeSpan(0, 0, 5);
QueueConnector.Initialize();
QueueClient queuClient = QueueConnector.TriviaQueueClient;
queuClient.Send(message);

}
catch (Exception ex)
{
HandleException(ex);
}
}

when i watch "var caller"
it always says it completed the request successfully. Not sure whats going on.

Thanks for any assistance