I am working on an application to perform context synchronization between multiple web hosted applications using SignalR. The client machine instantiates a host using the SignalR Owin host and the applications connect to it with a no-proxy version of the JS Client. The issue I am having is that the "Client" applications are hosted in SSL environments the SignalR host is not (as it is constrained to the local machine). If I try to connect to the Hub from a standard non-SSL website hosting the javascript client everything works. As soon as I load the client into an SSL website however I get a "SignalR: Error during negotiation request: undefined" when I try to start the connection. Anyone know a way around this?
Host:
public class SignalRHost : IDisposable
{
private IDisposable _webApp;
public SignalRHost(string url = "http://localhost:9000/")
{
_webApp = WebApplication.Start<Startup>(url);
}
public class Startup
{
public void Configuration(IAppBuilder app)
{
bool enableErrorDetail = false;
#if DEBUG
enableErrorDetail = true;
#endif
app.MapHubs(new HubConfiguration { EnableCrossDomain = true, EnableDetailedErrors = enableErrorDetail });
}
}
public void Dispose()
{
_webApp.Dispose();
}
}
JS Client:
(function (ns_HubClient) {
ns_HubClient.connection;
ns_HubClient.proxy;
ns_HubClient.initialize = function () {
ns_HubClient.connection = $.hubConnection("http://localhost:9000");
ns_HubClient.proxy = ns_HubClient.connection.createHubProxy("fluencyHub");
ns_HubClient.proxy.on('addMessage', function (data) { ns_HubClient.processMessage(data); });
ns_HubClient.connection.start()
.done(function () {
alert("connection complete");
})
.fail(function (data) {
alert("connection start failed: " + data);
});
};
ns_HubClient.login = function (sUserName, sPassword, sDomain) {
var fluencyMessage = {
MessageId: "",
CallType: "Asynchronous",
Method: "Login",
Status: "",
Response: {},
Request: {
sUserName: sUserName,
sPassword: sPassword,
sDomain: sDomain
}
};
ns_HubClient.sendMessage(fluencyMessage);
};
ns_HubClient.writeLog = function (message, errorLevel) {
var logMessage = {
ErrorLevel: errorLevel,
Message: message
};
ns_HubClient.proxy.invoke("logMessage", logMessage);
};
ns_HubClient.processMessage = function (message) {
};
ns_HubClient.sendMessage = function (data) {
ns_HubClient.proxy.invoke("addMessage", data);
};
} (window.ns_HubClient = window.ns_HubClient || {}));