I have got a small project working with SignalR, however i am getting some very inconsistent behavior.
<script type="text/javascript">
$(function () {
var chat = $.connection.brewBattleHub;
$.connection.hub.start().done(function () {
$("#broadcast").click(function () {
// Call the chat method on the server
chat.server.roll($("#username").val(), $("#drinkname").val());
});
chat.server.sendMessage("SignalR loaded...");
});
});
</script>
When i load the page, sometimes i am seeing the message "SignalR loaded", other times i am not.
There's is some other functionality on the page also, and sometimes this does not work either. If i click buttons and make things happen enough it will eventually all come through in one go... from this point it is all golden and works perfectly.
does start().done()
? not ensure it is all ready?
=== addendum, i am not referencing jquery mobile (google mentioned there is a bug when doing so)
See Question&Answers more detail:os