According to all documentation that i have come across i should be able to call $.connection.hub.id AFTER my connection has been started. this is my code:
var handshake = $.connection.handshakeHub;
$.connection.hub.start().done(function () {
console.dir($.connection.hub);
console.log('connection started with id: ' + $.connection.hub.id);
self.parentConnectionId = document.cookie.replace(/(?:(?:^|.*;\s*)connection\s*\=\s*([^;]*).*$)|^.*$/, "$1");
handshake.server.connect(self.parentConnectionId, $.connection.hub.id);
});
I am successfully connecting and the handshake proxy connect call hits the server so it is not like the connection is bombing. I have also inspected the property in the dev tools after the connection and the ID is still undefined.
I have tried this with version 2.1 and 2.2 of Signalr and no luck. Anyone have any experience with this? This is killin me.
This error may be seen if the project contains a folder called SignalR, which will interfere with the automatically-created proxy. To avoid this error, do not use a folder called SignalR in your application, or turn automatic proxy generation off.
SignalR is a free and open-source software library for Microsoft ASP.NET that allows server code to send asynchronous notifications to client-side web applications. The library includes server-side and client-side JavaScript components.
For anyone else that may have been googling/searching this (like me), ensure you've started your hub and it's connected.
$.connection.hub.start().done(function () {
console.log("id : %o", $.connection.hub.id);
});
I am an idiot. I had the proxy script tag included in two different spots in my solution. Removing one fixed the issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With