Javascript client doesn't reconnect #2095

Closed
YaakovDavis opened this Issue May 27, 2013 · 14 comments

Comments

Projects
None yet
5 participants
@YaakovDavis

SignalR version: 1.1.1
IIS 7.5
Windows 7 64 bit (ie. long polling)
Asp.Net 4.5 MVC project
Chrome 27.0

Repro steps:

  • Build server
  • Open page in Chrome - the page starts a hub connection.

Server sends signals, clients receives them, and everything works properly.

  • Now, rebuild project, which causes IIS app pool recycle.

Issue 1:
Client will no longer receive signals, even though I have the correct cononectionId on server side (I persisted it earlier, and I can see in Chrome dev tools that it's the same).

Issue 2:
disconnect event isn't fired on client side.

@ghost ghost assigned Xiaohongt May 28, 2013

@DamianEdwards

This comment has been minimized.

Show comment Hide comment
@DamianEdwards

DamianEdwards May 28, 2013

Owner

@Xiaohongt can you try and get a repro please.

Owner

DamianEdwards commented May 28, 2013

@Xiaohongt can you try and get a repro please.

@Xiaohongt

This comment has been minimized.

Show comment Hide comment
@Xiaohongt

Xiaohongt May 30, 2013

Contributor

@jake456, I tried on Windows 7 64 bit , I can't repro, could you please provide your repro app to us?

Contributor

Xiaohongt commented May 30, 2013

@jake456, I tried on Windows 7 64 bit , I can't repro, could you please provide your repro app to us?

@YaakovDavis

This comment has been minimized.

Show comment Hide comment
@YaakovDavis

YaakovDavis May 30, 2013

I'll prepare a repro, but before that let me add another detail:
The channel is cross-origin; i.e. I load a html file hosted on one IIS website, which establishes a SignalR connection with a service that resides on another.

(It's part of a mobile HTML app that resides on the device. At dev time I use 2 IIS websites with different ports; one serves the html content, the other hosts the service. They communicate with each other).

Could somehow affect the outcome? Could you try this scenario?

Also, did you fully rebuild the ASP.Net project? You should right-click it and select Rebuild, not Build. Otherwise, if no changes were detected, the app pool sometimes remains intact.

I'll prepare a repro, but before that let me add another detail:
The channel is cross-origin; i.e. I load a html file hosted on one IIS website, which establishes a SignalR connection with a service that resides on another.

(It's part of a mobile HTML app that resides on the device. At dev time I use 2 IIS websites with different ports; one serves the html content, the other hosts the service. They communicate with each other).

Could somehow affect the outcome? Could you try this scenario?

Also, did you fully rebuild the ASP.Net project? You should right-click it and select Rebuild, not Build. Otherwise, if no changes were detected, the app pool sometimes remains intact.

@YaakovDavis

This comment has been minimized.

Show comment Hide comment
@YaakovDavis

YaakovDavis May 30, 2013

//part of an MVC 4 app, .Net 4.5 on Win 7 64

public class ServiceHub : Hub
    {
        static string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "connectionIDs.txt");
        static IHubContext context = GlobalHost.ConnectionManager.GetHubContext<ServiceHub>();


        public override System.Threading.Tasks.Task OnConnected()
        {
            //for simplicity I persist the ids in a file; on our app we do it on a db
            File.AppendAllText(path, Context.ConnectionId + "\r\n");

            return base.OnConnected();
        }

        public static void Notify()
        {
            var cnIds = File.ReadAllLines(path);
            foreach (var id in cnIds)
            {
                context.Clients.Client(id).notify(DateTime.Now.ToString());
            }
        }
    }

//index.html - originates from a different domain

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>SignalR Client</title>
    <script src="Scripts/jquery-1.9.1.min.js"></script>
    <script src="Scripts/jquery.signalR-1.1.1.min.js"></script>
</head>
<body>
    Enter server address: <input id="serverAddress" type="text" />
    <button onclick="initSignalR()" >Init SignalR</button>

    <div>Notifications:</div>
    <div id="divNotifications" ></div>
    <script>
        function initSignalR() {
            var serverAddress = document.getElementById('serverAddress').value;

            $.support.cors = false;

            var hubConnection = $.hubConnection(serverAddress + "signalr", { useDefaultPath: false });
            hubConnection.logging = true;

            var hub = hubConnection.createHubProxy('serviceHub');

            hub.on('notify', function (n) {
                document.getElementById('divNotifications').innerText += n + '\r\n';
            });

            hubConnection.start();
        };
    </script>
</body>
</html>

//Application_Start in global.asax.cs

...
 RouteTable.Routes.MapHubs(new HubConfiguration { EnableCrossDomain = true });
...

//part of an MVC 4 app, .Net 4.5 on Win 7 64

public class ServiceHub : Hub
    {
        static string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "connectionIDs.txt");
        static IHubContext context = GlobalHost.ConnectionManager.GetHubContext<ServiceHub>();


        public override System.Threading.Tasks.Task OnConnected()
        {
            //for simplicity I persist the ids in a file; on our app we do it on a db
            File.AppendAllText(path, Context.ConnectionId + "\r\n");

            return base.OnConnected();
        }

        public static void Notify()
        {
            var cnIds = File.ReadAllLines(path);
            foreach (var id in cnIds)
            {
                context.Clients.Client(id).notify(DateTime.Now.ToString());
            }
        }
    }

//index.html - originates from a different domain

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>SignalR Client</title>
    <script src="Scripts/jquery-1.9.1.min.js"></script>
    <script src="Scripts/jquery.signalR-1.1.1.min.js"></script>
</head>
<body>
    Enter server address: <input id="serverAddress" type="text" />
    <button onclick="initSignalR()" >Init SignalR</button>

    <div>Notifications:</div>
    <div id="divNotifications" ></div>
    <script>
        function initSignalR() {
            var serverAddress = document.getElementById('serverAddress').value;

            $.support.cors = false;

            var hubConnection = $.hubConnection(serverAddress + "signalr", { useDefaultPath: false });
            hubConnection.logging = true;

            var hub = hubConnection.createHubProxy('serviceHub');

            hub.on('notify', function (n) {
                document.getElementById('divNotifications').innerText += n + '\r\n';
            });

            hubConnection.start();
        };
    </script>
</body>
</html>

//Application_Start in global.asax.cs

...
 RouteTable.Routes.MapHubs(new HubConfiguration { EnableCrossDomain = true });
...

@ghost ghost assigned gustavo-armenta Jun 5, 2013

@davidfowl

This comment has been minimized.

Show comment Hide comment
@davidfowl

davidfowl Jun 12, 2013

Owner

@Xiaohongt any updates on this?

Owner

davidfowl commented Jun 12, 2013

@Xiaohongt any updates on this?

@gustavo-armenta

This comment has been minimized.

Show comment Hide comment
@gustavo-armenta

gustavo-armenta Jun 17, 2013

Contributor

@jake456, I can't repro the issue. Using a web client long polling on cross domain raises the reconnecting event and reconnects as expected. You could try to see if you can get a repro using https://github.com/gustavo-armenta/SignalR-Clients/tree/master/samples/Microsoft.AspNet.SignalR.Client.WebJavaScript.Samples

If you can't use this repro, try sharing your javascript console log as I do here. It might help us understand the problem.

[12:28:47 GMT-0700 (Pacific Daylight Time)] SignalR: Auto detected cross domain url. jquery.signalR-1.1.2.js:54
[12:28:47 GMT-0700 (Pacific Daylight Time)] SignalR: Negotiating with 'http://signalr01.cloudapp.net/signalr/negotiate'. jquery.signalR-1.1.2.js:54
[12:28:47 GMT-0700 (Pacific Daylight Time)] SignalR: SignalR: Initializing long polling connection with server. jquery.signalR-1.1.2.js:54
[12:28:47 GMT-0700 (Pacific Daylight Time)] SignalR: Attempting to connect to 'http://signalr01.cloudapp.net/signalr/connect?transport=longPolling&connect…uqql0&connectionData=%5B%7B%22name%22%3A%22hubconnectionapi%22%7D%5D&tid=4' using longPolling. jquery.signalR-1.1.2.js:54
[12:28:47 GMT-0700 (Pacific Daylight Time)] SignalR: Longpolling connected jquery.signalR-1.1.2.js:54
[12:28:47 GMT-0700 (Pacific Daylight Time)] SignalR: Triggering client hub event 'displayMessage' on hub 'HubConnectionAPI'. jquery.signalR-1.1.2.js:54
[12:28:47 GMT-0700 (Pacific Daylight Time)] SignalR: Attempting to connect to 'http://signalr01.cloudapp.net/signalr/poll?transport=longPolling&connection…22hubconnectionapi%22%7D%5D&messageId=B%2C1%7CG%2C0%7CH%2C0%7CI%2C0&tid=10' using longPolling. jquery.signalR-1.1.2.js:54
[12:28:48 GMT-0700 (Pacific Daylight Time)] SignalR: Triggering client hub event 'displayMessage' on hub 'HubConnectionAPI'. jquery.signalR-1.1.2.js:54
[12:28:48 GMT-0700 (Pacific Daylight Time)] SignalR: Attempting to connect to 'http://signalr01.cloudapp.net/signalr/poll?transport=longPolling&connection…22hubconnectionapi%22%7D%5D&messageId=B%2C1%7CG%2C1%7CH%2C0%7CI%2C0&tid=10' using longPolling. jquery.signalR-1.1.2.js:54
[12:28:48 GMT-0700 (Pacific Daylight Time)] SignalR: Attempting to connect to 'http://signalr01.cloudapp.net/signalr/poll?transport=longPolling&connection…-Xr1LC5kET2EY-qyy01&messageId=B%2C1%7CG%2C1%7CH%2C1%7CI%2C0%7CF%2C1&tid=10' using longPolling. jquery.signalR-1.1.2.js:54
XMLHttpRequest cannot load http://signalr01.cloudapp.net/signalr/poll?transport=longPolling&connection…y01&messageId=B%2C1%7CG%2C1%7CH%2C1%7CI%2C0%7CF%2C1&tid=10&_=1371497326732. Origin http://localhost:6700 is not allowed by Access-Control-Allow-Origin. localhost/:1
[12:29:04 GMT-0700 (Pacific Daylight Time)] SignalR: An error occurred using longPolling. Status = error. undefined jquery.signalR-1.1.2.js:54
[12:29:04 GMT-0700 (Pacific Daylight Time)] SignalR: SignalR: Initializing long polling connection with server. jquery.signalR-1.1.2.js:54
XMLHttpRequest cannot load http://signalr01.cloudapp.net/signalr/ping?_=1371497326733. Origin http://localhost:6700 is not allowed by Access-Control-Allow-Origin. localhost/:1
[12:29:04 GMT-0700 (Pacific Daylight Time)] SignalR: SignalR: Server ping failed because 'SignalR: Error pinging server: error', re-trying ping. jquery.signalR-1.1.2.js:54
XMLHttpRequest cannot load http://signalr01.cloudapp.net/signalr/ping?_=1371497326734. Origin http://localhost:6700 is not allowed by Access-Control-Allow-Origin. localhost/:1
[12:29:07 GMT-0700 (Pacific Daylight Time)] SignalR: SignalR: Server ping failed because 'SignalR: Error pinging server: error', re-trying ping. jquery.signalR-1.1.2.js:54
[12:29:14 GMT-0700 (Pacific Daylight Time)] SignalR: Attempting to connect to 'http://signalr01.cloudapp.net/signalr/reconnect?transport=longPolling&conne…Y-Xr1LC5kET2EY-qyy01&messageId=B%2C1%7CG%2C1%7CH%2C1%7CI%2C0%7CF%2C1&tid=9' using longPolling. jquery.signalR-1.1.2.js:54
[12:29:15 GMT-0700 (Pacific Daylight Time)] SignalR: Raising the reconnect event jquery.signalR-1.1.2.js:54
[12:29:15 GMT-0700 (Pacific Daylight Time)] SignalR: Triggering client hub event 'displayMessage' on hub 'HubConnectionAPI'. jquery.signalR-1.1.2.js:54
[12:29:15 GMT-0700 (Pacific Daylight Time)] SignalR: Attempting to connect to 'http://signalr01.cloudapp.net/signalr/poll?transport=longPolling&connection…Y-Xr1LC5kET2EY-qyy01&messageId=B%2C0%7CC%2C1%7CD%2C0%7CE%2C0%7CF%2C0&tid=8' using longPolling. jquery.signalR-1.1.2.js:54
Contributor

gustavo-armenta commented Jun 17, 2013

@jake456, I can't repro the issue. Using a web client long polling on cross domain raises the reconnecting event and reconnects as expected. You could try to see if you can get a repro using https://github.com/gustavo-armenta/SignalR-Clients/tree/master/samples/Microsoft.AspNet.SignalR.Client.WebJavaScript.Samples

If you can't use this repro, try sharing your javascript console log as I do here. It might help us understand the problem.

[12:28:47 GMT-0700 (Pacific Daylight Time)] SignalR: Auto detected cross domain url. jquery.signalR-1.1.2.js:54
[12:28:47 GMT-0700 (Pacific Daylight Time)] SignalR: Negotiating with 'http://signalr01.cloudapp.net/signalr/negotiate'. jquery.signalR-1.1.2.js:54
[12:28:47 GMT-0700 (Pacific Daylight Time)] SignalR: SignalR: Initializing long polling connection with server. jquery.signalR-1.1.2.js:54
[12:28:47 GMT-0700 (Pacific Daylight Time)] SignalR: Attempting to connect to 'http://signalr01.cloudapp.net/signalr/connect?transport=longPolling&connect…uqql0&connectionData=%5B%7B%22name%22%3A%22hubconnectionapi%22%7D%5D&tid=4' using longPolling. jquery.signalR-1.1.2.js:54
[12:28:47 GMT-0700 (Pacific Daylight Time)] SignalR: Longpolling connected jquery.signalR-1.1.2.js:54
[12:28:47 GMT-0700 (Pacific Daylight Time)] SignalR: Triggering client hub event 'displayMessage' on hub 'HubConnectionAPI'. jquery.signalR-1.1.2.js:54
[12:28:47 GMT-0700 (Pacific Daylight Time)] SignalR: Attempting to connect to 'http://signalr01.cloudapp.net/signalr/poll?transport=longPolling&connection…22hubconnectionapi%22%7D%5D&messageId=B%2C1%7CG%2C0%7CH%2C0%7CI%2C0&tid=10' using longPolling. jquery.signalR-1.1.2.js:54
[12:28:48 GMT-0700 (Pacific Daylight Time)] SignalR: Triggering client hub event 'displayMessage' on hub 'HubConnectionAPI'. jquery.signalR-1.1.2.js:54
[12:28:48 GMT-0700 (Pacific Daylight Time)] SignalR: Attempting to connect to 'http://signalr01.cloudapp.net/signalr/poll?transport=longPolling&connection…22hubconnectionapi%22%7D%5D&messageId=B%2C1%7CG%2C1%7CH%2C0%7CI%2C0&tid=10' using longPolling. jquery.signalR-1.1.2.js:54
[12:28:48 GMT-0700 (Pacific Daylight Time)] SignalR: Attempting to connect to 'http://signalr01.cloudapp.net/signalr/poll?transport=longPolling&connection…-Xr1LC5kET2EY-qyy01&messageId=B%2C1%7CG%2C1%7CH%2C1%7CI%2C0%7CF%2C1&tid=10' using longPolling. jquery.signalR-1.1.2.js:54
XMLHttpRequest cannot load http://signalr01.cloudapp.net/signalr/poll?transport=longPolling&connection…y01&messageId=B%2C1%7CG%2C1%7CH%2C1%7CI%2C0%7CF%2C1&tid=10&_=1371497326732. Origin http://localhost:6700 is not allowed by Access-Control-Allow-Origin. localhost/:1
[12:29:04 GMT-0700 (Pacific Daylight Time)] SignalR: An error occurred using longPolling. Status = error. undefined jquery.signalR-1.1.2.js:54
[12:29:04 GMT-0700 (Pacific Daylight Time)] SignalR: SignalR: Initializing long polling connection with server. jquery.signalR-1.1.2.js:54
XMLHttpRequest cannot load http://signalr01.cloudapp.net/signalr/ping?_=1371497326733. Origin http://localhost:6700 is not allowed by Access-Control-Allow-Origin. localhost/:1
[12:29:04 GMT-0700 (Pacific Daylight Time)] SignalR: SignalR: Server ping failed because 'SignalR: Error pinging server: error', re-trying ping. jquery.signalR-1.1.2.js:54
XMLHttpRequest cannot load http://signalr01.cloudapp.net/signalr/ping?_=1371497326734. Origin http://localhost:6700 is not allowed by Access-Control-Allow-Origin. localhost/:1
[12:29:07 GMT-0700 (Pacific Daylight Time)] SignalR: SignalR: Server ping failed because 'SignalR: Error pinging server: error', re-trying ping. jquery.signalR-1.1.2.js:54
[12:29:14 GMT-0700 (Pacific Daylight Time)] SignalR: Attempting to connect to 'http://signalr01.cloudapp.net/signalr/reconnect?transport=longPolling&conne…Y-Xr1LC5kET2EY-qyy01&messageId=B%2C1%7CG%2C1%7CH%2C1%7CI%2C0%7CF%2C1&tid=9' using longPolling. jquery.signalR-1.1.2.js:54
[12:29:15 GMT-0700 (Pacific Daylight Time)] SignalR: Raising the reconnect event jquery.signalR-1.1.2.js:54
[12:29:15 GMT-0700 (Pacific Daylight Time)] SignalR: Triggering client hub event 'displayMessage' on hub 'HubConnectionAPI'. jquery.signalR-1.1.2.js:54
[12:29:15 GMT-0700 (Pacific Daylight Time)] SignalR: Attempting to connect to 'http://signalr01.cloudapp.net/signalr/poll?transport=longPolling&connection…Y-Xr1LC5kET2EY-qyy01&messageId=B%2C0%7CC%2C1%7CD%2C0%7CE%2C0%7CF%2C0&tid=8' using longPolling. jquery.signalR-1.1.2.js:54
@YaakovDavis

This comment has been minimized.

Show comment Hide comment
@YaakovDavis

YaakovDavis Jun 18, 2013

gustavo, just to make sure we're on the same page:
Did you kill the IIS app pool?

gustavo, just to make sure we're on the same page:
Did you kill the IIS app pool?

@YaakovDavis

This comment has been minimized.

Show comment Hide comment
@YaakovDavis

YaakovDavis Jun 18, 2013

Here's a few log events during normal activity:
[11:41:16 GMT+0300 (Jerusalem Daylight Time)] SignalR: Triggering client hub event 'notify' on hub 'GameHub'. jquery.signalR-1.1.2.min.js:10
[11:41:16 GMT+0300 (Jerusalem Daylight Time)] SignalR: Attempting to connect to 'http://dev.zozatree.com:84/signalr/poll?transport=longPolling&connectionTok…8nARL41NrpGQvEO9gNhCupi6nMgSgOhHsguDxwPwG2S73DRgWyv7pZCc0AfL4vjAZDZD&tid=0' using longPolling. jquery.signalR-1.1.2.min.js:10
[11:41:16 GMT+0300 (Jerusalem Daylight Time)] SignalR: Triggering client hub event 'notify' on hub 'GameHub'. jquery.signalR-1.1.2.min.js:10
[11:41:16 GMT+0300 (Jerusalem Daylight Time)] SignalR: Triggering client hub event 'notify' on hub 'GameHub'. jquery.signalR-1.1.2.min.js:10
[11:41:16 GMT+0300 (Jerusalem Daylight Time)] SignalR: Attempting to connect to 'http://dev.zozatree.com:84/signalr/poll?transport=longPolling&connectionTok…8nARL41NrpGQvEO9gNhCupi6nMgSgOhHsguDxwPwG2S73DRgWyv7pZCc0AfL4vjAZDZD&tid=5' using longPolling. jquery.signalR-1.1.2.min.js:10
[11:41:24 GMT+0300 (Jerusalem Daylight Time)] SignalR: Attempting to connect to 'http://dev.zozatree.com:84/signalr/poll?transport=longPolling&connectionTok…8nARL41NrpGQvEO9gNhCupi6nMgSgOhHsguDxwPwG2S73DRgWyv7pZCc0AfL4vjAZDZD&tid=7' using longPolling. jquery.signalR-1.1.2.min.js:10

When rebuilding the project, I get the following event:

GET http://dev.zozatree.com:84/signalr/poll?transport=longPolling&connectionTok…D&tid=7&callback=jQuery191005158027354627848_1371544839224&_=1371544839230 500 (Internal Server Error) jquery-1.9.1.min.js:5
b.ajaxTransport.send jquery-1.9.1.min.js:5
b.extend.ajax jquery-1.9.1.min.js:5
e jquery.signalR-1.1.2.min.js:10
r.transports.longPolling.start.l.init.t.setTimeout.s.pollXhr.n.ajax.success jquery.signalR-1.1.2.min.js:10
b.Callbacks.c jquery-1.9.1.min.js:3
b.Callbacks.p.fireWith jquery-1.9.1.min.js:3
k jquery-1.9.1.min.js:5
b.ajaxTransport.send.n.onload.n.onreadystatechange

Afterwards, SignalR refuses to sync any more.
As said, I don't get disconnect events on either client or server side.

Here's a few log events during normal activity:
[11:41:16 GMT+0300 (Jerusalem Daylight Time)] SignalR: Triggering client hub event 'notify' on hub 'GameHub'. jquery.signalR-1.1.2.min.js:10
[11:41:16 GMT+0300 (Jerusalem Daylight Time)] SignalR: Attempting to connect to 'http://dev.zozatree.com:84/signalr/poll?transport=longPolling&connectionTok…8nARL41NrpGQvEO9gNhCupi6nMgSgOhHsguDxwPwG2S73DRgWyv7pZCc0AfL4vjAZDZD&tid=0' using longPolling. jquery.signalR-1.1.2.min.js:10
[11:41:16 GMT+0300 (Jerusalem Daylight Time)] SignalR: Triggering client hub event 'notify' on hub 'GameHub'. jquery.signalR-1.1.2.min.js:10
[11:41:16 GMT+0300 (Jerusalem Daylight Time)] SignalR: Triggering client hub event 'notify' on hub 'GameHub'. jquery.signalR-1.1.2.min.js:10
[11:41:16 GMT+0300 (Jerusalem Daylight Time)] SignalR: Attempting to connect to 'http://dev.zozatree.com:84/signalr/poll?transport=longPolling&connectionTok…8nARL41NrpGQvEO9gNhCupi6nMgSgOhHsguDxwPwG2S73DRgWyv7pZCc0AfL4vjAZDZD&tid=5' using longPolling. jquery.signalR-1.1.2.min.js:10
[11:41:24 GMT+0300 (Jerusalem Daylight Time)] SignalR: Attempting to connect to 'http://dev.zozatree.com:84/signalr/poll?transport=longPolling&connectionTok…8nARL41NrpGQvEO9gNhCupi6nMgSgOhHsguDxwPwG2S73DRgWyv7pZCc0AfL4vjAZDZD&tid=7' using longPolling. jquery.signalR-1.1.2.min.js:10

When rebuilding the project, I get the following event:

GET http://dev.zozatree.com:84/signalr/poll?transport=longPolling&connectionTok…D&tid=7&callback=jQuery191005158027354627848_1371544839224&_=1371544839230 500 (Internal Server Error) jquery-1.9.1.min.js:5
b.ajaxTransport.send jquery-1.9.1.min.js:5
b.extend.ajax jquery-1.9.1.min.js:5
e jquery.signalR-1.1.2.min.js:10
r.transports.longPolling.start.l.init.t.setTimeout.s.pollXhr.n.ajax.success jquery.signalR-1.1.2.min.js:10
b.Callbacks.c jquery-1.9.1.min.js:3
b.Callbacks.p.fireWith jquery-1.9.1.min.js:3
k jquery-1.9.1.min.js:5
b.ajaxTransport.send.n.onload.n.onreadystatechange

Afterwards, SignalR refuses to sync any more.
As said, I don't get disconnect events on either client or server side.

@davidfowl

This comment has been minimized.

Show comment Hide comment
@davidfowl

davidfowl Jun 18, 2013

Owner

Can you figure out what the 500 is? Building the project (i.e. restarting the app domain) doesn't cause a 500 in most cases so that might be something specific to your project.

Can you make a new project and reproduce the issue?

Owner

davidfowl commented Jun 18, 2013

Can you figure out what the 500 is? Building the project (i.e. restarting the app domain) doesn't cause a 500 in most cases so that might be something specific to your project.

Can you make a new project and reproduce the issue?

@YaakovDavis

This comment has been minimized.

Show comment Hide comment
@YaakovDavis

YaakovDavis Jun 18, 2013

I can see the following repeated errors in my server logs:
2013-06-18 15:41:38,960 ERROR 59 - System.InvalidOperationException: Protocol error: Missing connection token.
at Microsoft.AspNet.SignalR.PersistentConnection.ProcessRequest(HostContext context)
at Microsoft.AspNet.SignalR.Owin.CallHandler.Invoke(IDictionary2 environment) at Microsoft.AspNet.SignalR.Owin.Handlers.HubDispatcherHandler.Invoke(IDictionary2 environment)
at Microsoft.Owin.Host.SystemWeb.OwinCallContext.Execute()
at Microsoft.Owin.Host.SystemWeb.OwinHttpHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object extraData)
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.Owin.Host.SystemWeb.CallContextAsyncResult.End(IAsyncResult result)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

I can see the following repeated errors in my server logs:
2013-06-18 15:41:38,960 ERROR 59 - System.InvalidOperationException: Protocol error: Missing connection token.
at Microsoft.AspNet.SignalR.PersistentConnection.ProcessRequest(HostContext context)
at Microsoft.AspNet.SignalR.Owin.CallHandler.Invoke(IDictionary2 environment) at Microsoft.AspNet.SignalR.Owin.Handlers.HubDispatcherHandler.Invoke(IDictionary2 environment)
at Microsoft.Owin.Host.SystemWeb.OwinCallContext.Execute()
at Microsoft.Owin.Host.SystemWeb.OwinHttpHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object extraData)
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.Owin.Host.SystemWeb.CallContextAsyncResult.End(IAsyncResult result)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

@davidfowl

This comment has been minimized.

Show comment Hide comment
@davidfowl

davidfowl Jun 25, 2013

Owner

@jake456 when does that error happen? Do you know if it's related? We can't reproduce your issue locally.

Owner

davidfowl commented Jun 25, 2013

@jake456 when does that error happen? Do you know if it's related? We can't reproduce your issue locally.

@YaakovDavis

This comment has been minimized.

Show comment Hide comment
@YaakovDavis

YaakovDavis Jun 25, 2013

The only "unorthodox" thing I might be doing, is that I occasionally throw exceptions from OnConnected on server side.
(I do so when the query string, as set by the qs property on client, doesn't contain sufficient auth tokens).

Could this cause somehow the issues I'm describing?

The only "unorthodox" thing I might be doing, is that I occasionally throw exceptions from OnConnected on server side.
(I do so when the query string, as set by the qs property on client, doesn't contain sufficient auth tokens).

Could this cause somehow the issues I'm describing?

@davidfowl

This comment has been minimized.

Show comment Hide comment
@davidfowl

davidfowl Jun 25, 2013

Owner

@jake456 not sure but that's not the right place to be doing auth as the client will just fallback to the next transport. We have an explicit way to do auth, you can find more details here http://www.asp.net/signalr/overview/security.

As for this specific issue, unless you have some more details about how we can reproduce the issue I'm not sure it makes sense to keep this open.

Owner

davidfowl commented Jun 25, 2013

@jake456 not sure but that's not the right place to be doing auth as the client will just fallback to the next transport. We have an explicit way to do auth, you can find more details here http://www.asp.net/signalr/overview/security.

As for this specific issue, unless you have some more details about how we can reproduce the issue I'm not sure it makes sense to keep this open.

@YaakovDavis

This comment has been minimized.

Show comment Hide comment
@YaakovDavis

YaakovDavis Jun 25, 2013

  1. This fallback behavior is worth mentioning in the docs.
  2. Perhaps you should add OnConnecting, where the server can safely reject connections, without changing the transport logic. This will be more obvious from the API perspective.

I've removed the auth logic from OnConnected, and am closing the issue.

  1. This fallback behavior is worth mentioning in the docs.
  2. Perhaps you should add OnConnecting, where the server can safely reject connections, without changing the transport logic. This will be more obvious from the API perspective.

I've removed the auth logic from OnConnected, and am closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment