asp.net mvc 4 - SignalR connection error -


i have simple chat client project running using signalr , mvc identical asp.net one (i'm experimenting - client code identical). i've wired following watch things occur:

$.connection.hub.statechanged(function(state){console.log(state)}); 

the connections working fine i've noticed if shut down iis express , watch console in chrome, see this:

//as expect state goes connected connecting object {oldstate: 1, newstate: 2}  //then times out after 30 secs , throws awesomeness @ console websocket connection 'ws://localhost:61623/signalr?transport=websockets&connectiontoken=vdf640emz7pfmtoc6vxle_5-7qs5dzmszv4spbqo7efemsssitnwkszreqfl4mgq8txitg2xb5f-2zdhp-2t3shpzn2hemty1zmewlb8non5oruvexasoark9xjeo5b00&connectiondata=%5b%7b%22name%22%3a%22chathub%22%7d%5d&messageid=b%2c7%7cl%2c0%7cm%2c0%7cn%2c0&tid=0' failed: websocket closed before connection established. jquery.signalr-1.0.1.js:1117  //reconnecting disconnecting - why error above? object {oldstate: 2, newstate: 4}   //then radio silence if start iis again... 

2 questions:

how avoid error when attempted reconnection fails?

why doesn't signalr continue try , connect iis? under impression point of technology...

edit: same thing happens in firefox too

eventually, connection die , stop retrying. can have continuously reconnect method signalr docs.

how continuously reconnect

how continuously reconnect

in applications might want automatically re-establish connection after has been lost , attempt reconnect has timed out. that, can call start method closed event handler (disconnected event handler on javascript clients). might want wait period of time before calling start in order avoid doing when server or physical connection unavailable. following code sample javascript client using generated proxy.

$.connection.hub.disconnected(function() {    settimeout(function() {        $.connection.hub.start();    }, 5000); // restart connection after 5 seconds. }); 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -