Update: SignalR 2.1
https://github.com/SignalR/SignalR/releases/tag/2.1.0
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Microsoft.AspNet.SignalR.Utils" version="2.0.3" />
|
<package id="Microsoft.AspNet.SignalR.Utils" version="2.1.0" />
|
||||||
</packages>
|
</packages>
|
||||||
@@ -42,8 +42,9 @@
|
|||||||
<Reference Include="LumenWorks.Framework.IO">
|
<Reference Include="LumenWorks.Framework.IO">
|
||||||
<HintPath>..\packages\LumenWorks.Framework.IO.3.8.0\lib\net20\LumenWorks.Framework.IO.dll</HintPath>
|
<HintPath>..\packages\LumenWorks.Framework.IO.3.8.0\lib\net20\LumenWorks.Framework.IO.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.AspNet.SignalR.Core">
|
<Reference Include="Microsoft.AspNet.SignalR.Core, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Microsoft.AspNet.SignalR.Core.2.0.3\lib\net45\Microsoft.AspNet.SignalR.Core.dll</HintPath>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\packages\Microsoft.AspNet.SignalR.Core.2.1.0\lib\net45\Microsoft.AspNet.SignalR.Core.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Owin">
|
<Reference Include="Microsoft.Owin">
|
||||||
<HintPath>..\packages\Microsoft.Owin.2.0.1\lib\net45\Microsoft.Owin.dll</HintPath>
|
<HintPath>..\packages\Microsoft.Owin.2.0.1\lib\net45\Microsoft.Owin.dll</HintPath>
|
||||||
@@ -361,7 +362,7 @@
|
|||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<ProjectExtensions>
|
<ProjectExtensions>
|
||||||
<VisualStudio>
|
<VisualStudio>
|
||||||
<UserProperties BuildVersion_UpdateFileVersion="True" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_StartDate="2011/7/1" BuildVersion_BuildAction="Both" BuildVersion_DetectChanges="False" BuildVersion_UseGlobalSettings="False" />
|
<UserProperties BuildVersion_UseGlobalSettings="False" BuildVersion_DetectChanges="False" BuildVersion_BuildAction="Both" BuildVersion_StartDate="2011/7/1" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_UpdateFileVersion="True" />
|
||||||
</VisualStudio>
|
</VisualStudio>
|
||||||
</ProjectExtensions>
|
</ProjectExtensions>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<package id="LumenWorks.Framework.IO" version="3.8.0" targetFramework="net45" />
|
<package id="LumenWorks.Framework.IO" version="3.8.0" targetFramework="net45" />
|
||||||
<package id="Microsoft.AspNet.Mvc" version="4.0.30506.0" targetFramework="net45" />
|
<package id="Microsoft.AspNet.Mvc" version="4.0.30506.0" targetFramework="net45" />
|
||||||
<package id="Microsoft.AspNet.Razor" version="2.0.30506.0" targetFramework="net45" />
|
<package id="Microsoft.AspNet.Razor" version="2.0.30506.0" targetFramework="net45" />
|
||||||
<package id="Microsoft.AspNet.SignalR.Core" version="2.0.3" targetFramework="net45" />
|
<package id="Microsoft.AspNet.SignalR.Core" version="2.1.0" targetFramework="net45" />
|
||||||
<package id="Microsoft.AspNet.WebPages" version="2.0.30506.0" targetFramework="net45" />
|
<package id="Microsoft.AspNet.WebPages" version="2.0.30506.0" targetFramework="net45" />
|
||||||
<package id="Microsoft.Owin" version="2.0.1" targetFramework="net45" />
|
<package id="Microsoft.Owin" version="2.0.1" targetFramework="net45" />
|
||||||
<package id="Microsoft.Owin.Security" version="2.0.1" targetFramework="net45" />
|
<package id="Microsoft.Owin.Security" version="2.0.1" targetFramework="net45" />
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
///#source 1 1 /ClientSource/Scripts/Modules/jQuery-SignalR/jquery.signalR-2.0.3.js
|
///#source 1 1 /ClientSource/Scripts/Modules/jQuery-SignalR/jquery.signalR-2.1.0.js
|
||||||
/* jquery.signalR.core.js */
|
/* jquery.signalR.core.js */
|
||||||
/*global window:false */
|
/*global window:false */
|
||||||
/*!
|
/*!
|
||||||
* ASP.NET SignalR JavaScript Library v2.0.3
|
* ASP.NET SignalR JavaScript Library v2.1.0
|
||||||
* http://signalr.net/
|
* http://signalr.net/
|
||||||
*
|
*
|
||||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||||
@@ -12,7 +12,6 @@
|
|||||||
/// <reference path="Scripts/jquery-1.6.4.js" />
|
/// <reference path="Scripts/jquery-1.6.4.js" />
|
||||||
/// <reference path="jquery.signalR.version.js" />
|
/// <reference path="jquery.signalR.version.js" />
|
||||||
(function ($, window, undefined) {
|
(function ($, window, undefined) {
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var resources = {
|
var resources = {
|
||||||
nojQuery: "jQuery was not found. Please ensure jQuery is referenced before the SignalR client JavaScript file.",
|
nojQuery: "jQuery was not found. Please ensure jQuery is referenced before the SignalR client JavaScript file.",
|
||||||
@@ -21,6 +20,10 @@
|
|||||||
stoppedWhileLoading: "The connection was stopped during page load.",
|
stoppedWhileLoading: "The connection was stopped during page load.",
|
||||||
stoppedWhileNegotiating: "The connection was stopped during the negotiate request.",
|
stoppedWhileNegotiating: "The connection was stopped during the negotiate request.",
|
||||||
errorParsingNegotiateResponse: "Error parsing negotiate response.",
|
errorParsingNegotiateResponse: "Error parsing negotiate response.",
|
||||||
|
errorDuringStartRequest: "Error during start request. Stopping the connection.",
|
||||||
|
stoppedDuringStartRequest: "The connection was stopped during the start request.",
|
||||||
|
errorParsingStartResponse: "Error parsing start response: '{0}'. Stopping the connection.",
|
||||||
|
invalidStartResponse: "Invalid start response: '{0}'. Stopping the connection.",
|
||||||
protocolIncompatible: "You are using a version of the client that isn't compatible with the server. Client version {0}, server version {1}.",
|
protocolIncompatible: "You are using a version of the client that isn't compatible with the server. Client version {0}, server version {1}.",
|
||||||
sendFailed: "Send failed.",
|
sendFailed: "Send failed.",
|
||||||
parseFailed: "Failed at parsing response: {0}",
|
parseFailed: "Failed at parsing response: {0}",
|
||||||
@@ -33,7 +36,9 @@
|
|||||||
pingServerFailedStatusCode: "Failed to ping server. Server responded with status code {0}, stopping the connection.",
|
pingServerFailedStatusCode: "Failed to ping server. Server responded with status code {0}, stopping the connection.",
|
||||||
pingServerFailedParse: "Failed to parse ping server response, stopping the connection.",
|
pingServerFailedParse: "Failed to parse ping server response, stopping the connection.",
|
||||||
noConnectionTransport: "Connection is in an invalid state, there is no transport active.",
|
noConnectionTransport: "Connection is in an invalid state, there is no transport active.",
|
||||||
webSocketsInvalidState: "The Web Socket transport is in an invalid state, transitioning into reconnecting."
|
webSocketsInvalidState: "The Web Socket transport is in an invalid state, transitioning into reconnecting.",
|
||||||
|
reconnectTimeout: "Couldn't reconnect within the configured timeout of {0} ms, disconnecting.",
|
||||||
|
reconnectWindowTimeout: "The client has been inactive since {0} and it has exceeded the inactivity timeout of {1} ms. Stopping the connection."
|
||||||
};
|
};
|
||||||
|
|
||||||
if (typeof ($) !== "function") {
|
if (typeof ($) !== "function") {
|
||||||
@@ -95,6 +100,11 @@
|
|||||||
return connection.state === signalR.connectionState.disconnected;
|
return connection.state === signalR.connectionState.disconnected;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
supportsKeepAlive = function (connection) {
|
||||||
|
return connection._.keepAliveData.activated &&
|
||||||
|
connection.transport.supportsKeepAlive(connection);
|
||||||
|
},
|
||||||
|
|
||||||
configureStopReconnectingTimeout = function (connection) {
|
configureStopReconnectingTimeout = function (connection) {
|
||||||
var stopReconnectingTimeout,
|
var stopReconnectingTimeout,
|
||||||
onReconnectTimeout;
|
onReconnectTimeout;
|
||||||
@@ -103,7 +113,9 @@
|
|||||||
// Without this check if a connection is stopped then started events will be bound multiple times.
|
// Without this check if a connection is stopped then started events will be bound multiple times.
|
||||||
if (!connection._.configuredStopReconnectingTimeout) {
|
if (!connection._.configuredStopReconnectingTimeout) {
|
||||||
onReconnectTimeout = function (connection) {
|
onReconnectTimeout = function (connection) {
|
||||||
connection.log("Couldn't reconnect within the configured timeout (" + connection.disconnectTimeout + "ms), disconnecting.");
|
var message = signalR._.format(signalR.resources.reconnectTimeout, connection.disconnectTimeout);
|
||||||
|
connection.log(message);
|
||||||
|
$(connection).triggerHandler(events.onError, [signalR._.error(message, /* source */ "TimeoutException")]);
|
||||||
connection.stop(/* async */ false, /* notifyServer */ false);
|
connection.stop(/* async */ false, /* notifyServer */ false);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -323,6 +335,7 @@
|
|||||||
|
|
||||||
this.url = url;
|
this.url = url;
|
||||||
this.qs = qs;
|
this.qs = qs;
|
||||||
|
this.lastError = null;
|
||||||
this._ = {
|
this._ = {
|
||||||
keepAliveData: {},
|
keepAliveData: {},
|
||||||
connectingMessageBuffer: new ConnectingMessageBuffer(this, function (message) {
|
connectingMessageBuffer: new ConnectingMessageBuffer(this, function (message) {
|
||||||
@@ -352,6 +365,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_originalJson: window.JSON,
|
||||||
|
|
||||||
json: window.JSON,
|
json: window.JSON,
|
||||||
|
|
||||||
isCrossDomain: function (url, against) {
|
isCrossDomain: function (url, against) {
|
||||||
@@ -387,7 +402,7 @@
|
|||||||
|
|
||||||
state: signalR.connectionState.disconnected,
|
state: signalR.connectionState.disconnected,
|
||||||
|
|
||||||
clientProtocol: "1.3",
|
clientProtocol: "1.4",
|
||||||
|
|
||||||
reconnectDelay: 2000,
|
reconnectDelay: 2000,
|
||||||
|
|
||||||
@@ -414,6 +429,8 @@
|
|||||||
deferred = connection._deferral || $.Deferred(), // Check to see if there is a pre-existing deferral that's being built on, if so we want to keep using it
|
deferred = connection._deferral || $.Deferred(), // Check to see if there is a pre-existing deferral that's being built on, if so we want to keep using it
|
||||||
parser = window.document.createElement("a");
|
parser = window.document.createElement("a");
|
||||||
|
|
||||||
|
connection.lastError = null;
|
||||||
|
|
||||||
// Persist the deferral so that if start is called multiple times the same deferral is used.
|
// Persist the deferral so that if start is called multiple times the same deferral is used.
|
||||||
connection._deferral = deferred;
|
connection._deferral = deferred;
|
||||||
|
|
||||||
@@ -471,14 +488,14 @@
|
|||||||
parser.href = connection.url;
|
parser.href = connection.url;
|
||||||
if (!parser.protocol || parser.protocol === ":") {
|
if (!parser.protocol || parser.protocol === ":") {
|
||||||
connection.protocol = window.document.location.protocol;
|
connection.protocol = window.document.location.protocol;
|
||||||
connection.host = window.document.location.host;
|
connection.host = parser.host || window.document.location.host;
|
||||||
connection.baseUrl = connection.protocol + "//" + connection.host;
|
|
||||||
} else {
|
} else {
|
||||||
connection.protocol = parser.protocol;
|
connection.protocol = parser.protocol;
|
||||||
connection.host = parser.host;
|
connection.host = parser.host;
|
||||||
connection.baseUrl = parser.protocol + "//" + parser.host;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
connection.baseUrl = connection.protocol + "//" + connection.host;
|
||||||
|
|
||||||
// Set the websocket protocol
|
// Set the websocket protocol
|
||||||
connection.wsProtocol = connection.protocol === "https:" ? "wss://" : "ws://";
|
connection.wsProtocol = connection.protocol === "https:" ? "wss://" : "ws://";
|
||||||
|
|
||||||
@@ -587,7 +604,7 @@
|
|||||||
|
|
||||||
window.clearTimeout(connection._.onFailedTimeoutHandle);
|
window.clearTimeout(connection._.onFailedTimeoutHandle);
|
||||||
|
|
||||||
if (transport.supportsKeepAlive && connection._.keepAliveData.activated) {
|
if (supportsKeepAlive(connection)) {
|
||||||
signalR.transports._logic.monitorKeepAlive(connection);
|
signalR.transports._logic.monitorKeepAlive(connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -647,23 +664,11 @@
|
|||||||
|
|
||||||
url = signalR.transports._logic.prepareQueryString(connection, url);
|
url = signalR.transports._logic.prepareQueryString(connection, url);
|
||||||
|
|
||||||
// Add the client version to the negotiate request. We utilize the same addQs method here
|
|
||||||
// so that it can append the clientVersion appropriately to the URL
|
|
||||||
url = signalR.transports._logic.addQs(url, {
|
|
||||||
clientProtocol: connection.clientProtocol
|
|
||||||
});
|
|
||||||
|
|
||||||
connection.log("Negotiating with '" + url + "'.");
|
connection.log("Negotiating with '" + url + "'.");
|
||||||
|
|
||||||
// Save the ajax negotiate request object so we can abort it if stop is called while the request is in flight.
|
// Save the ajax negotiate request object so we can abort it if stop is called while the request is in flight.
|
||||||
connection._.negotiateRequest = $.ajax(
|
connection._.negotiateRequest = signalR.transports._logic.ajax(connection, {
|
||||||
$.extend({}, $.signalR.ajaxDefaults, {
|
|
||||||
xhrFields: { withCredentials: connection.withCredentials },
|
|
||||||
url: url,
|
url: url,
|
||||||
type: "GET",
|
|
||||||
contentType: connection.contentType,
|
|
||||||
data: {},
|
|
||||||
dataType: connection.ajaxDataType,
|
|
||||||
error: function (error, statusText) {
|
error: function (error, statusText) {
|
||||||
// We don't want to cause any errors if we're aborting our own negotiate request.
|
// We don't want to cause any errors if we're aborting our own negotiate request.
|
||||||
if (statusText !== _negotiateAbortText) {
|
if (statusText !== _negotiateAbortText) {
|
||||||
@@ -692,6 +697,7 @@
|
|||||||
connection.id = res.ConnectionId;
|
connection.id = res.ConnectionId;
|
||||||
connection.token = res.ConnectionToken;
|
connection.token = res.ConnectionToken;
|
||||||
connection.webSocketServerUrl = res.WebSocketServerUrl;
|
connection.webSocketServerUrl = res.WebSocketServerUrl;
|
||||||
|
connection._.longPollDelay = res.LongPollDelay * 1000; // in ms
|
||||||
|
|
||||||
// Once the server has labeled the PersistentConnection as Disconnected, we should stop attempting to reconnect
|
// Once the server has labeled the PersistentConnection as Disconnected, we should stop attempting to reconnect
|
||||||
// after res.DisconnectTimeout seconds.
|
// after res.DisconnectTimeout seconds.
|
||||||
@@ -748,8 +754,7 @@
|
|||||||
|
|
||||||
initialize(transports);
|
initialize(transports);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
));
|
|
||||||
|
|
||||||
return deferred.promise();
|
return deferred.promise();
|
||||||
},
|
},
|
||||||
@@ -814,6 +819,7 @@
|
|||||||
/// <returns type="signalR" />
|
/// <returns type="signalR" />
|
||||||
var connection = this;
|
var connection = this;
|
||||||
$(connection).bind(events.onError, function (e, errorData, sendData) {
|
$(connection).bind(events.onError, function (e, errorData, sendData) {
|
||||||
|
connection.lastError = errorData;
|
||||||
// In practice 'errorData' is the SignalR built error object.
|
// In practice 'errorData' is the SignalR built error object.
|
||||||
// In practice 'sendData' is undefined for all error events except those triggered by
|
// In practice 'sendData' is undefined for all error events except those triggered by
|
||||||
// 'ajaxSend' and 'webSockets.send'.'sendData' is the original send payload.
|
// 'ajaxSend' and 'webSockets.send'.'sendData' is the original send payload.
|
||||||
@@ -883,7 +889,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Always clean up private non-timeout based state.
|
// Always clean up private non-timeout based state.
|
||||||
delete connection._deferral;
|
|
||||||
delete connection._.config;
|
delete connection._.config;
|
||||||
delete connection._.deferredStartHandler;
|
delete connection._.deferredStartHandler;
|
||||||
|
|
||||||
@@ -921,7 +926,7 @@
|
|||||||
connection.transport.abort(connection, async);
|
connection.transport.abort(connection, async);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connection.transport.supportsKeepAlive && connection._.keepAliveData.activated) {
|
if (supportsKeepAlive(connection)) {
|
||||||
signalR.transports._logic.stopMonitoringKeepAlive(connection);
|
signalR.transports._logic.stopMonitoringKeepAlive(connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -934,15 +939,20 @@
|
|||||||
delete connection._.negotiateRequest;
|
delete connection._.negotiateRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure that tryAbortStartRequest is called before connection._deferral is deleted
|
||||||
|
signalR.transports._logic.tryAbortStartRequest(connection);
|
||||||
|
|
||||||
// Trigger the disconnect event
|
// Trigger the disconnect event
|
||||||
$(connection).triggerHandler(events.onDisconnect);
|
$(connection).triggerHandler(events.onDisconnect);
|
||||||
|
|
||||||
|
delete connection._deferral;
|
||||||
delete connection.messageId;
|
delete connection.messageId;
|
||||||
delete connection.groupsToken;
|
delete connection.groupsToken;
|
||||||
delete connection.id;
|
delete connection.id;
|
||||||
delete connection._.pingIntervalId;
|
delete connection._.pingIntervalId;
|
||||||
delete connection._.lastMessageAt;
|
delete connection._.lastMessageAt;
|
||||||
delete connection._.lastActiveAt;
|
delete connection._.lastActiveAt;
|
||||||
|
delete connection._.longPollDelay;
|
||||||
|
|
||||||
// Clear out our message buffer
|
// Clear out our message buffer
|
||||||
connection._.connectingMessageBuffer.clear();
|
connection._.connectingMessageBuffer.clear();
|
||||||
@@ -980,11 +990,11 @@
|
|||||||
/// <reference path="jquery.signalR.core.js" />
|
/// <reference path="jquery.signalR.core.js" />
|
||||||
|
|
||||||
(function ($, window, undefined) {
|
(function ($, window, undefined) {
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var signalR = $.signalR,
|
var signalR = $.signalR,
|
||||||
events = $.signalR.events,
|
events = $.signalR.events,
|
||||||
changeState = $.signalR.changeState,
|
changeState = $.signalR.changeState,
|
||||||
|
startAbortText = "__Start Aborted__",
|
||||||
transportLogic;
|
transportLogic;
|
||||||
|
|
||||||
signalR.transports = {};
|
signalR.transports = {};
|
||||||
@@ -1029,36 +1039,43 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function addConnectionData(url, connectionData) {
|
function getAjaxUrl(connection, path) {
|
||||||
var appender = url.indexOf("?") !== -1 ? "&" : "?";
|
var url = connection.url + path;
|
||||||
|
|
||||||
if (connectionData) {
|
if (connection.transport) {
|
||||||
url += appender + "connectionData=" + window.encodeURIComponent(connectionData);
|
url += "?transport=" + connection.transport.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
return url;
|
return transportLogic.prepareQueryString(connection, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
transportLogic = signalR.transports._logic = {
|
transportLogic = signalR.transports._logic = {
|
||||||
|
ajax: function (connection, options) {
|
||||||
|
return $.ajax(
|
||||||
|
$.extend(/*deep copy*/ true, {}, $.signalR.ajaxDefaults, {
|
||||||
|
type: "GET",
|
||||||
|
data: {},
|
||||||
|
xhrFields: { withCredentials: connection.withCredentials },
|
||||||
|
contentType: connection.contentType,
|
||||||
|
dataType: connection.ajaxDataType
|
||||||
|
}, options));
|
||||||
|
},
|
||||||
|
|
||||||
pingServer: function (connection) {
|
pingServer: function (connection) {
|
||||||
/// <summary>Pings the server</summary>
|
/// <summary>Pings the server</summary>
|
||||||
/// <param name="connection" type="signalr">Connection associated with the server ping</param>
|
/// <param name="connection" type="signalr">Connection associated with the server ping</param>
|
||||||
/// <returns type="signalR" />
|
/// <returns type="signalR" />
|
||||||
var url, deferral = $.Deferred(), xhr;
|
var url,
|
||||||
|
xhr,
|
||||||
|
deferral = $.Deferred();
|
||||||
|
|
||||||
if (connection.transport) {
|
if (connection.transport) {
|
||||||
url = connection.url + "/ping";
|
url = connection.url + "/ping";
|
||||||
|
|
||||||
url = transportLogic.addQs(url, connection.qs);
|
url = transportLogic.addQs(url, connection.qs);
|
||||||
|
|
||||||
xhr = $.ajax(
|
xhr = transportLogic.ajax(connection, {
|
||||||
$.extend({}, $.signalR.ajaxDefaults, {
|
|
||||||
xhrFields: { withCredentials: connection.withCredentials },
|
|
||||||
url: url,
|
url: url,
|
||||||
type: "GET",
|
|
||||||
contentType: connection.contentType,
|
|
||||||
data: {},
|
|
||||||
dataType: connection.ajaxDataType,
|
|
||||||
success: function (result) {
|
success: function (result) {
|
||||||
var data;
|
var data;
|
||||||
|
|
||||||
@@ -1084,7 +1101,7 @@
|
|||||||
else {
|
else {
|
||||||
deferral.reject(
|
deferral.reject(
|
||||||
signalR._.transportError(
|
signalR._.transportError(
|
||||||
signalR._.format(signalR.resources.pingServerFailedInvalidResponse, result.responseText),
|
signalR._.format(signalR.resources.pingServerFailedInvalidResponse, result),
|
||||||
connection.transport,
|
connection.transport,
|
||||||
null /* error */,
|
null /* error */,
|
||||||
xhr
|
xhr
|
||||||
@@ -1115,9 +1132,7 @@
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
deferral.reject(
|
deferral.reject(
|
||||||
@@ -1132,9 +1147,23 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
prepareQueryString: function (connection, url) {
|
prepareQueryString: function (connection, url) {
|
||||||
url = transportLogic.addQs(url, connection.qs);
|
var preparedUrl;
|
||||||
|
|
||||||
return addConnectionData(url, connection.data);
|
// Use addQs to start since it handles the ?/& prefix for us
|
||||||
|
preparedUrl = transportLogic.addQs(url, "clientProtocol=" + connection.clientProtocol);
|
||||||
|
|
||||||
|
// Add the user-specified query string params if any
|
||||||
|
preparedUrl = transportLogic.addQs(preparedUrl, connection.qs);
|
||||||
|
|
||||||
|
if (connection.token) {
|
||||||
|
preparedUrl += "&connectionToken=" + window.encodeURIComponent(connection.token);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (connection.data) {
|
||||||
|
preparedUrl += "&connectionData=" + window.encodeURIComponent(connection.data);
|
||||||
|
}
|
||||||
|
|
||||||
|
return preparedUrl;
|
||||||
},
|
},
|
||||||
|
|
||||||
addQs: function (url, qs) {
|
addQs: function (url, qs) {
|
||||||
@@ -1166,7 +1195,7 @@
|
|||||||
/// <summary>Gets the url for making a GET based connect request</summary>
|
/// <summary>Gets the url for making a GET based connect request</summary>
|
||||||
var baseUrl = transport === "webSockets" ? "" : connection.baseUrl,
|
var baseUrl = transport === "webSockets" ? "" : connection.baseUrl,
|
||||||
url = baseUrl + connection.appRelativeUrl,
|
url = baseUrl + connection.appRelativeUrl,
|
||||||
qs = "transport=" + transport + "&connectionToken=" + window.encodeURIComponent(connection.token);
|
qs = "transport=" + transport;
|
||||||
|
|
||||||
if (connection.groupsToken) {
|
if (connection.groupsToken) {
|
||||||
qs += "&groupsToken=" + window.encodeURIComponent(connection.groupsToken);
|
qs += "&groupsToken=" + window.encodeURIComponent(connection.groupsToken);
|
||||||
@@ -1219,21 +1248,17 @@
|
|||||||
|
|
||||||
ajaxSend: function (connection, data) {
|
ajaxSend: function (connection, data) {
|
||||||
var payload = transportLogic.stringifySend(connection, data),
|
var payload = transportLogic.stringifySend(connection, data),
|
||||||
url = connection.url + "/send" + "?transport=" + connection.transport.name + "&connectionToken=" + window.encodeURIComponent(connection.token),
|
url = getAjaxUrl(connection, "/send"),
|
||||||
xhr,
|
xhr,
|
||||||
onFail = function (error, connection) {
|
onFail = function (error, connection) {
|
||||||
$(connection).triggerHandler(events.onError, [signalR._.transportError(signalR.resources.sendFailed, connection.transport, error, xhr), data]);
|
$(connection).triggerHandler(events.onError, [signalR._.transportError(signalR.resources.sendFailed, connection.transport, error, xhr), data]);
|
||||||
};
|
};
|
||||||
|
|
||||||
url = transportLogic.prepareQueryString(connection, url);
|
|
||||||
|
|
||||||
xhr = $.ajax(
|
xhr = transportLogic.ajax(connection, {
|
||||||
$.extend({}, $.signalR.ajaxDefaults, {
|
|
||||||
xhrFields: { withCredentials: connection.withCredentials },
|
|
||||||
url: url,
|
url: url,
|
||||||
type: connection.ajaxDataType === "jsonp" ? "GET" : "POST",
|
type: connection.ajaxDataType === "jsonp" ? "GET" : "POST",
|
||||||
contentType: signalR._.defaultContentType,
|
contentType: signalR._.defaultContentType,
|
||||||
dataType: connection.ajaxDataType,
|
|
||||||
data: {
|
data: {
|
||||||
data: payload
|
data: payload
|
||||||
},
|
},
|
||||||
@@ -1263,8 +1288,7 @@
|
|||||||
|
|
||||||
onFail(error, connection);
|
onFail(error, connection);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
));
|
|
||||||
|
|
||||||
return xhr;
|
return xhr;
|
||||||
},
|
},
|
||||||
@@ -1277,28 +1301,81 @@
|
|||||||
// Async by default unless explicitly overidden
|
// Async by default unless explicitly overidden
|
||||||
async = typeof async === "undefined" ? true : async;
|
async = typeof async === "undefined" ? true : async;
|
||||||
|
|
||||||
var url = connection.url + "/abort" + "?transport=" + connection.transport.name + "&connectionToken=" + window.encodeURIComponent(connection.token);
|
var url = getAjaxUrl(connection, "/abort");
|
||||||
url = transportLogic.prepareQueryString(connection, url);
|
|
||||||
|
|
||||||
$.ajax(
|
transportLogic.ajax(connection, {
|
||||||
$.extend({}, $.signalR.ajaxDefaults, {
|
|
||||||
xhrFields: { withCredentials: connection.withCredentials },
|
|
||||||
url: url,
|
url: url,
|
||||||
async: async,
|
async: async,
|
||||||
timeout: 1000,
|
timeout: 1000,
|
||||||
type: "POST",
|
type: "POST"
|
||||||
contentType: connection.contentType,
|
});
|
||||||
dataType: connection.ajaxDataType,
|
|
||||||
data: {}
|
|
||||||
}
|
|
||||||
));
|
|
||||||
|
|
||||||
connection.log("Fired ajax abort async = " + async + ".");
|
connection.log("Fired ajax abort async = " + async + ".");
|
||||||
},
|
},
|
||||||
|
|
||||||
tryInitialize: function (persistentResponse, onInitialized) {
|
tryInitialize: function (connection, persistentResponse, onInitialized) {
|
||||||
|
var startUrl,
|
||||||
|
xhr,
|
||||||
|
rejectDeferred = function (error) {
|
||||||
|
var deferred = connection._deferral;
|
||||||
|
if (deferred) {
|
||||||
|
deferred.reject(error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
triggerStartError = function (error) {
|
||||||
|
$(connection).triggerHandler(events.onError, [error]);
|
||||||
|
rejectDeferred(error);
|
||||||
|
connection.stop();
|
||||||
|
};
|
||||||
|
|
||||||
if (persistentResponse.Initialized) {
|
if (persistentResponse.Initialized) {
|
||||||
|
startUrl = getAjaxUrl(connection, "/start");
|
||||||
|
|
||||||
|
xhr = transportLogic.ajax(connection, {
|
||||||
|
url: startUrl,
|
||||||
|
success: function (result) {
|
||||||
|
var data;
|
||||||
|
|
||||||
|
try {
|
||||||
|
data = connection._parseResponse(result);
|
||||||
|
} catch (error) {
|
||||||
|
triggerStartError(signalR._.error(
|
||||||
|
signalR._.format(signalR.resources.errorParsingStartResponse, result),
|
||||||
|
error, xhr));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.Response === "started") {
|
||||||
onInitialized();
|
onInitialized();
|
||||||
|
} else {
|
||||||
|
triggerStartError(signalR._.error(
|
||||||
|
signalR._.format(signalR.resources.invalidStartResponse, result),
|
||||||
|
null /* error */, xhr));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (error, statusText) {
|
||||||
|
if (statusText !== startAbortText) {
|
||||||
|
triggerStartError(signalR._.error(
|
||||||
|
signalR.resources.errorDuringStartRequest,
|
||||||
|
error, xhr));
|
||||||
|
} else {
|
||||||
|
// Stop has been called
|
||||||
|
rejectDeferred(signalR._.error(
|
||||||
|
signalR.resources.stoppedDuringStartRequest,
|
||||||
|
null /* error */, xhr));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
connection._.startRequest = xhr;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
tryAbortStartRequest: function (connection) {
|
||||||
|
if (connection._.startRequest) {
|
||||||
|
// If the start request has already completed this will noop.
|
||||||
|
connection._.startRequest.abort(startAbortText);
|
||||||
|
delete connection._.startRequest;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -1317,14 +1394,6 @@
|
|||||||
if (minData) {
|
if (minData) {
|
||||||
data = transportLogic.maximizePersistentResponse(minData);
|
data = transportLogic.maximizePersistentResponse(minData);
|
||||||
|
|
||||||
if (data.Disconnect) {
|
|
||||||
connection.log("Disconnect command received from server.");
|
|
||||||
|
|
||||||
// Disconnected by the server
|
|
||||||
connection.stop(false, false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
transportLogic.updateGroups(connection, data.GroupsToken);
|
transportLogic.updateGroups(connection, data.GroupsToken);
|
||||||
|
|
||||||
if (data.MessageId) {
|
if (data.MessageId) {
|
||||||
@@ -1336,7 +1405,7 @@
|
|||||||
transportLogic.triggerReceived(connection, message);
|
transportLogic.triggerReceived(connection, message);
|
||||||
});
|
});
|
||||||
|
|
||||||
transportLogic.tryInitialize(data, onInitialized);
|
transportLogic.tryInitialize(connection, data, onInitialized);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -1423,8 +1492,10 @@
|
|||||||
|
|
||||||
verifyLastActive: function (connection) {
|
verifyLastActive: function (connection) {
|
||||||
if (new Date().getTime() - connection._.lastActiveAt >= connection.reconnectWindow) {
|
if (new Date().getTime() - connection._.lastActiveAt >= connection.reconnectWindow) {
|
||||||
connection.log("There has not been an active server connection for an extended period of time. Stopping connection.");
|
var message = signalR._.format(signalR.resources.reconnectWindowTimeout, new Date(connection._.lastActiveAt), connection.reconnectWindow);
|
||||||
connection.stop();
|
connection.log(message);
|
||||||
|
$(connection).triggerHandler(events.onError, [signalR._.error(message, /* source */ "TimeoutException")]);
|
||||||
|
connection.stop(/* async */ false, /* notifyServer */ false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1487,7 +1558,6 @@
|
|||||||
/// <reference path="jquery.signalR.transports.common.js" />
|
/// <reference path="jquery.signalR.transports.common.js" />
|
||||||
|
|
||||||
(function ($, window, undefined) {
|
(function ($, window, undefined) {
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var signalR = $.signalR,
|
var signalR = $.signalR,
|
||||||
events = $.signalR.events,
|
events = $.signalR.events,
|
||||||
@@ -1497,7 +1567,9 @@
|
|||||||
signalR.transports.webSockets = {
|
signalR.transports.webSockets = {
|
||||||
name: "webSockets",
|
name: "webSockets",
|
||||||
|
|
||||||
supportsKeepAlive: true,
|
supportsKeepAlive: function () {
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
send: function (connection, data) {
|
send: function (connection, data) {
|
||||||
var payload = transportLogic.stringifySend(connection, data);
|
var payload = transportLogic.stringifySend(connection, data);
|
||||||
@@ -1639,17 +1711,22 @@
|
|||||||
/// <reference path="jquery.signalR.transports.common.js" />
|
/// <reference path="jquery.signalR.transports.common.js" />
|
||||||
|
|
||||||
(function ($, window, undefined) {
|
(function ($, window, undefined) {
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var signalR = $.signalR,
|
var signalR = $.signalR,
|
||||||
events = $.signalR.events,
|
events = $.signalR.events,
|
||||||
changeState = $.signalR.changeState,
|
changeState = $.signalR.changeState,
|
||||||
transportLogic = signalR.transports._logic;
|
transportLogic = signalR.transports._logic,
|
||||||
|
clearReconnectAttemptTimeout = function (connection) {
|
||||||
|
window.clearTimeout(connection._.reconnectAttemptTimeoutHandle);
|
||||||
|
delete connection._.reconnectAttemptTimeoutHandle;
|
||||||
|
};
|
||||||
|
|
||||||
signalR.transports.serverSentEvents = {
|
signalR.transports.serverSentEvents = {
|
||||||
name: "serverSentEvents",
|
name: "serverSentEvents",
|
||||||
|
|
||||||
supportsKeepAlive: true,
|
supportsKeepAlive: function () {
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
timeOut: 3000,
|
timeOut: 3000,
|
||||||
|
|
||||||
@@ -1658,8 +1735,7 @@
|
|||||||
opened = false,
|
opened = false,
|
||||||
$connection = $(connection),
|
$connection = $(connection),
|
||||||
reconnecting = !onSuccess,
|
reconnecting = !onSuccess,
|
||||||
url,
|
url;
|
||||||
reconnectTimeout;
|
|
||||||
|
|
||||||
if (connection.eventSource) {
|
if (connection.eventSource) {
|
||||||
connection.log("The connection already has an event source. Stopping it.");
|
connection.log("The connection already has an event source. Stopping it.");
|
||||||
@@ -1696,7 +1772,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (reconnecting) {
|
if (reconnecting) {
|
||||||
reconnectTimeout = window.setTimeout(function () {
|
connection._.reconnectAttemptTimeoutHandle = window.setTimeout(function () {
|
||||||
if (opened === false) {
|
if (opened === false) {
|
||||||
// If we're reconnecting and the event source is attempting to connect,
|
// If we're reconnecting and the event source is attempting to connect,
|
||||||
// don't keep retrying. This causes duplicate connections to spawn.
|
// don't keep retrying. This causes duplicate connections to spawn.
|
||||||
@@ -1712,10 +1788,7 @@
|
|||||||
connection.eventSource.addEventListener("open", function (e) {
|
connection.eventSource.addEventListener("open", function (e) {
|
||||||
connection.log("EventSource connected.");
|
connection.log("EventSource connected.");
|
||||||
|
|
||||||
if (reconnectTimeout) {
|
clearReconnectAttemptTimeout(connection);
|
||||||
window.clearTimeout(reconnectTimeout);
|
|
||||||
}
|
|
||||||
|
|
||||||
transportLogic.clearReconnectTimeout(connection);
|
transportLogic.clearReconnectTimeout(connection);
|
||||||
|
|
||||||
if (opened === false) {
|
if (opened === false) {
|
||||||
@@ -1795,6 +1868,7 @@
|
|||||||
|
|
||||||
stop: function (connection) {
|
stop: function (connection) {
|
||||||
// Don't trigger a reconnect after stopping
|
// Don't trigger a reconnect after stopping
|
||||||
|
clearReconnectAttemptTimeout(connection);
|
||||||
transportLogic.clearReconnectTimeout(connection);
|
transportLogic.clearReconnectTimeout(connection);
|
||||||
|
|
||||||
if (connection && connection.eventSource) {
|
if (connection && connection.eventSource) {
|
||||||
@@ -1818,7 +1892,6 @@
|
|||||||
/// <reference path="jquery.signalR.transports.common.js" />
|
/// <reference path="jquery.signalR.transports.common.js" />
|
||||||
|
|
||||||
(function ($, window, undefined) {
|
(function ($, window, undefined) {
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var signalR = $.signalR,
|
var signalR = $.signalR,
|
||||||
events = $.signalR.events,
|
events = $.signalR.events,
|
||||||
@@ -1873,7 +1946,9 @@
|
|||||||
signalR.transports.foreverFrame = {
|
signalR.transports.foreverFrame = {
|
||||||
name: "foreverFrame",
|
name: "foreverFrame",
|
||||||
|
|
||||||
supportsKeepAlive: true,
|
supportsKeepAlive: function () {
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
// Added as a value here so we can create tests to verify functionality
|
// Added as a value here so we can create tests to verify functionality
|
||||||
iframeClearThreshold: 50,
|
iframeClearThreshold: 50,
|
||||||
@@ -1963,9 +2038,21 @@
|
|||||||
|
|
||||||
receive: function (connection, data) {
|
receive: function (connection, data) {
|
||||||
var cw,
|
var cw,
|
||||||
body;
|
body,
|
||||||
|
response;
|
||||||
|
|
||||||
transportLogic.processMessages(connection, data, connection.onSuccess);
|
if (connection.json !== connection._originalJson) {
|
||||||
|
// If there's a custom JSON parser configured then serialize the object
|
||||||
|
// using the original (browser) JSON parser and then deserialize it using
|
||||||
|
// the custom parser (connection._parseResponse does that). This is so we
|
||||||
|
// can easily send the response from the server as "raw" JSON but still
|
||||||
|
// support custom JSON deserialization in the browser.
|
||||||
|
data = connection._originalJson.stringify(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
response = connection._parseResponse(data);
|
||||||
|
|
||||||
|
transportLogic.processMessages(connection, response, connection.onSuccess);
|
||||||
|
|
||||||
// Protect against connection stopping from a callback trigger within the processMessages above.
|
// Protect against connection stopping from a callback trigger within the processMessages above.
|
||||||
if (connection.state === $.signalR.connectionState.connected) {
|
if (connection.state === $.signalR.connectionState.connected) {
|
||||||
@@ -2049,18 +2136,33 @@
|
|||||||
/// <reference path="jquery.signalR.transports.common.js" />
|
/// <reference path="jquery.signalR.transports.common.js" />
|
||||||
|
|
||||||
(function ($, window, undefined) {
|
(function ($, window, undefined) {
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var signalR = $.signalR,
|
var signalR = $.signalR,
|
||||||
events = $.signalR.events,
|
events = $.signalR.events,
|
||||||
changeState = $.signalR.changeState,
|
changeState = $.signalR.changeState,
|
||||||
isDisconnecting = $.signalR.isDisconnecting,
|
isDisconnecting = $.signalR.isDisconnecting,
|
||||||
transportLogic = signalR.transports._logic;
|
transportLogic = signalR.transports._logic,
|
||||||
|
browserSupportsXHRProgress = (function () {
|
||||||
|
try {
|
||||||
|
return "onprogress" in new window.XMLHttpRequest();
|
||||||
|
} catch (e) {
|
||||||
|
// No XHR means no XHR progress event
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
signalR.transports.longPolling = {
|
signalR.transports.longPolling = {
|
||||||
name: "longPolling",
|
name: "longPolling",
|
||||||
|
|
||||||
supportsKeepAlive: false,
|
supportsKeepAlive: function (connection) {
|
||||||
|
return browserSupportsXHRProgress &&
|
||||||
|
connection.ajaxDataType !== "jsonp" &&
|
||||||
|
// Don't check for keep alives if there is a delay configured between poll requests.
|
||||||
|
// Don't check for keep alives if the server didn't send back the "LongPollDelay" as
|
||||||
|
// part of the response to /negotiate. That indicates the server is running an older
|
||||||
|
// version of SignalR that doesn't send long polling keep alives.
|
||||||
|
connection._.longPollDelay === 0;
|
||||||
|
},
|
||||||
|
|
||||||
reconnectDelay: 3000,
|
reconnectDelay: 3000,
|
||||||
|
|
||||||
@@ -2071,10 +2173,11 @@
|
|||||||
fireConnect = function () {
|
fireConnect = function () {
|
||||||
fireConnect = $.noop;
|
fireConnect = $.noop;
|
||||||
|
|
||||||
connection.log("LongPolling connected.");
|
|
||||||
onSuccess();
|
|
||||||
// Reset onFailed to null because it shouldn't be called again
|
// Reset onFailed to null because it shouldn't be called again
|
||||||
onFailed = null;
|
onFailed = null;
|
||||||
|
|
||||||
|
connection.log("LongPolling connected.");
|
||||||
|
onSuccess();
|
||||||
},
|
},
|
||||||
tryFailConnect = function () {
|
tryFailConnect = function () {
|
||||||
if (onFailed) {
|
if (onFailed) {
|
||||||
@@ -2126,13 +2229,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
connection.log("Opening long polling request to '" + url + "'.");
|
connection.log("Opening long polling request to '" + url + "'.");
|
||||||
instance.pollXhr = $.ajax(
|
instance.pollXhr = transportLogic.ajax(connection, {
|
||||||
$.extend({}, $.signalR.ajaxDefaults, {
|
xhrFields: {
|
||||||
xhrFields: { withCredentials: connection.withCredentials },
|
onprogress: function () {
|
||||||
|
transportLogic.markLastMessage(connection);
|
||||||
|
}
|
||||||
|
},
|
||||||
url: url,
|
url: url,
|
||||||
type: "GET",
|
|
||||||
dataType: connection.ajaxDataType,
|
|
||||||
contentType: connection.contentType,
|
|
||||||
success: function (result) {
|
success: function (result) {
|
||||||
var minData,
|
var minData,
|
||||||
delay = 0,
|
delay = 0,
|
||||||
@@ -2146,6 +2249,7 @@
|
|||||||
reconnectErrors = 0;
|
reconnectErrors = 0;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// Remove any keep-alives from the beginning of the result
|
||||||
minData = connection._parseResponse(result);
|
minData = connection._parseResponse(result);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
@@ -2240,9 +2344,7 @@
|
|||||||
}, that.reconnectDelay);
|
}, that.reconnectDelay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
));
|
|
||||||
|
|
||||||
|
|
||||||
// This will only ever pass after an error has occured via the poll ajax procedure.
|
// This will only ever pass after an error has occured via the poll ajax procedure.
|
||||||
if (reconnecting && raiseReconnect === true) {
|
if (reconnecting && raiseReconnect === true) {
|
||||||
@@ -2258,7 +2360,9 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
lostConnection: function (connection) {
|
lostConnection: function (connection) {
|
||||||
throw new Error("Lost Connection not handled for LongPolling");
|
if (connection.pollXhr) {
|
||||||
|
connection.pollXhr.abort("lostConnection");
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
send: function (connection, data) {
|
send: function (connection, data) {
|
||||||
@@ -2295,7 +2399,6 @@
|
|||||||
/// <reference path="jquery.signalR.core.js" />
|
/// <reference path="jquery.signalR.core.js" />
|
||||||
|
|
||||||
(function ($, window, undefined) {
|
(function ($, window, undefined) {
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var eventNamespace = ".hubProxy",
|
var eventNamespace = ".hubProxy",
|
||||||
signalR = $.signalR;
|
signalR = $.signalR;
|
||||||
@@ -2458,7 +2561,15 @@
|
|||||||
// Update the hub state
|
// Update the hub state
|
||||||
$.extend(that.state, result.State);
|
$.extend(that.state, result.State);
|
||||||
|
|
||||||
if (result.Error) {
|
if (result.Progress) {
|
||||||
|
if (d.notifyWith) {
|
||||||
|
// Progress is only supported in jQuery 1.7+
|
||||||
|
d.notifyWith(that, [result.Progress.Data]);
|
||||||
|
} else if(!connection._.progressjQueryVersionLogged) {
|
||||||
|
connection.log("A hub method invocation progress update was received but the version of jQuery in use (" + $.prototype.jquery + ") does not support progress updates. Upgrade to jQuery 1.7+ to receive progress notifications.");
|
||||||
|
connection._.progressjQueryVersionLogged = true;
|
||||||
|
}
|
||||||
|
} else if (result.Error) {
|
||||||
// Server hub method threw an exception, log it & reject the deferred
|
// Server hub method threw an exception, log it & reject the deferred
|
||||||
if (result.StackTrace) {
|
if (result.StackTrace) {
|
||||||
connection.log(result.Error + "\n" + result.StackTrace + ".");
|
connection.log(result.Error + "\n" + result.StackTrace + ".");
|
||||||
@@ -2495,6 +2606,10 @@
|
|||||||
return {
|
return {
|
||||||
State: minHubResponse.S,
|
State: minHubResponse.S,
|
||||||
Result: minHubResponse.R,
|
Result: minHubResponse.R,
|
||||||
|
Progress: minHubResponse.P ? {
|
||||||
|
Id: minHubResponse.P.I,
|
||||||
|
Data: minHubResponse.P.D
|
||||||
|
} : null,
|
||||||
Id: minHubResponse.I,
|
Id: minHubResponse.I,
|
||||||
IsHubException: minHubResponse.H,
|
IsHubException: minHubResponse.H,
|
||||||
Error: minHubResponse.E,
|
Error: minHubResponse.E,
|
||||||
@@ -2553,7 +2668,17 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof (minData.I) !== "undefined") {
|
// We have to handle progress updates first in order to ensure old clients that receive
|
||||||
|
// progress updates enter the return value branch and then no-op when they can't find
|
||||||
|
// the callback in the map (because the minData.I value will not be a valid callback ID)
|
||||||
|
if (typeof (minData.P) !== "undefined") {
|
||||||
|
// Process progress notification
|
||||||
|
dataCallbackId = minData.P.I.toString();
|
||||||
|
callback = connection._.invocationCallbacks[dataCallbackId];
|
||||||
|
if (callback) {
|
||||||
|
callback.method.call(callback.scope, minData);
|
||||||
|
}
|
||||||
|
} else if (typeof (minData.I) !== "undefined") {
|
||||||
// We received the return value from a server method invocation, look up callback by id and call it
|
// We received the return value from a server method invocation, look up callback by id and call it
|
||||||
dataCallbackId = minData.I.toString();
|
dataCallbackId = minData.I.toString();
|
||||||
callback = connection._.invocationCallbacks[dataCallbackId];
|
callback = connection._.invocationCallbacks[dataCallbackId];
|
||||||
@@ -2690,12 +2815,12 @@
|
|||||||
/*global window:false */
|
/*global window:false */
|
||||||
/// <reference path="jquery.signalR.core.js" />
|
/// <reference path="jquery.signalR.core.js" />
|
||||||
(function ($, undefined) {
|
(function ($, undefined) {
|
||||||
$.signalR.version = "2.0.3";
|
$.signalR.version = "2.1.0";
|
||||||
}(window.jQuery));
|
}(window.jQuery));
|
||||||
|
|
||||||
///#source 1 1 /ClientSource/Scripts/Modules/jQuery-SignalR/disco-hubs.js
|
///#source 1 1 /ClientSource/Scripts/Modules/jQuery-SignalR/disco-hubs.js
|
||||||
/*!
|
/*!
|
||||||
* ASP.NET SignalR JavaScript Library v2.0.3
|
* ASP.NET SignalR JavaScript Library v2.1.0
|
||||||
* http://signalr.net/
|
* http://signalr.net/
|
||||||
*
|
*
|
||||||
* Copyright Microsoft Open Technologies, Inc. All rights reserved.
|
* Copyright Microsoft Open Technologies, Inc. All rights reserved.
|
||||||
@@ -2774,37 +2899,38 @@
|
|||||||
registerHubProxies(proxies, false);
|
registerHubProxies(proxies, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
proxies.deviceUpdates = this.createHubProxy('deviceUpdates');
|
proxies['deviceUpdates'] = this.createHubProxy('deviceUpdates');
|
||||||
proxies.deviceUpdates.client = { };
|
proxies['deviceUpdates'].client = { };
|
||||||
proxies.deviceUpdates.server = {
|
proxies['deviceUpdates'].server = {
|
||||||
};
|
};
|
||||||
|
|
||||||
proxies.jobUpdates = this.createHubProxy('jobUpdates');
|
proxies['jobUpdates'] = this.createHubProxy('jobUpdates');
|
||||||
proxies.jobUpdates.client = { };
|
proxies['jobUpdates'].client = { };
|
||||||
proxies.jobUpdates.server = {
|
proxies['jobUpdates'].server = {
|
||||||
};
|
};
|
||||||
|
|
||||||
proxies.logNotifications = this.createHubProxy('logNotifications');
|
proxies['logNotifications'] = this.createHubProxy('logNotifications');
|
||||||
proxies.logNotifications.client = { };
|
proxies['logNotifications'].client = { };
|
||||||
proxies.logNotifications.server = {
|
proxies['logNotifications'].server = {
|
||||||
};
|
};
|
||||||
|
|
||||||
proxies.noticeboardUpdates = this.createHubProxy('noticeboardUpdates');
|
proxies['noticeboardUpdates'] = this.createHubProxy('noticeboardUpdates');
|
||||||
proxies.noticeboardUpdates.client = { };
|
proxies['noticeboardUpdates'].client = { };
|
||||||
proxies.noticeboardUpdates.server = {
|
proxies['noticeboardUpdates'].server = {
|
||||||
};
|
};
|
||||||
|
|
||||||
proxies.scheduledTaskNotifications = this.createHubProxy('scheduledTaskNotifications');
|
proxies['scheduledTaskNotifications'] = this.createHubProxy('scheduledTaskNotifications');
|
||||||
proxies.scheduledTaskNotifications.client = { };
|
proxies['scheduledTaskNotifications'].client = { };
|
||||||
proxies.scheduledTaskNotifications.server = {
|
proxies['scheduledTaskNotifications'].server = {
|
||||||
getStatus: function () {
|
getStatus: function () {
|
||||||
return proxies.scheduledTaskNotifications.invoke.apply(proxies.scheduledTaskNotifications, $.merge(["GetStatus"], $.makeArray(arguments)));
|
/// <summary>Calls the GetStatus method on the server-side scheduledTaskNotifications hub. Returns a jQuery.Deferred() promise.</summary>
|
||||||
|
return proxies['scheduledTaskNotifications'].invoke.apply(proxies['scheduledTaskNotifications'], $.merge(["GetStatus"], $.makeArray(arguments)));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
proxies.userUpdates = this.createHubProxy('userUpdates');
|
proxies['userUpdates'] = this.createHubProxy('userUpdates');
|
||||||
proxies.userUpdates.client = { };
|
proxies['userUpdates'].client = { };
|
||||||
proxies.userUpdates.server = {
|
proxies['userUpdates'].server = {
|
||||||
};
|
};
|
||||||
|
|
||||||
return proxies;
|
return proxies;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<bundle minify="true" runOnBuild="true">
|
<bundle minify="true" runOnBuild="true">
|
||||||
<file>/ClientSource/Scripts/Modules/jQuery-SignalR/jquery.signalR-2.0.3.js</file>
|
<file>/ClientSource/Scripts/Modules/jQuery-SignalR/jquery.signalR-2.1.0.js</file>
|
||||||
<file>/ClientSource/Scripts/Modules/jQuery-SignalR/disco-hubs.js</file>
|
<file>/ClientSource/Scripts/Modules/jQuery-SignalR/disco-hubs.js</file>
|
||||||
</bundle>
|
</bundle>
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
|
|||||||
/*!
|
/*!
|
||||||
* ASP.NET SignalR JavaScript Library v2.0.3
|
* ASP.NET SignalR JavaScript Library v2.1.0
|
||||||
* http://signalr.net/
|
* http://signalr.net/
|
||||||
*
|
*
|
||||||
* Copyright Microsoft Open Technologies, Inc. All rights reserved.
|
* Copyright Microsoft Open Technologies, Inc. All rights reserved.
|
||||||
@@ -78,37 +78,38 @@
|
|||||||
registerHubProxies(proxies, false);
|
registerHubProxies(proxies, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
proxies.deviceUpdates = this.createHubProxy('deviceUpdates');
|
proxies['deviceUpdates'] = this.createHubProxy('deviceUpdates');
|
||||||
proxies.deviceUpdates.client = { };
|
proxies['deviceUpdates'].client = { };
|
||||||
proxies.deviceUpdates.server = {
|
proxies['deviceUpdates'].server = {
|
||||||
};
|
};
|
||||||
|
|
||||||
proxies.jobUpdates = this.createHubProxy('jobUpdates');
|
proxies['jobUpdates'] = this.createHubProxy('jobUpdates');
|
||||||
proxies.jobUpdates.client = { };
|
proxies['jobUpdates'].client = { };
|
||||||
proxies.jobUpdates.server = {
|
proxies['jobUpdates'].server = {
|
||||||
};
|
};
|
||||||
|
|
||||||
proxies.logNotifications = this.createHubProxy('logNotifications');
|
proxies['logNotifications'] = this.createHubProxy('logNotifications');
|
||||||
proxies.logNotifications.client = { };
|
proxies['logNotifications'].client = { };
|
||||||
proxies.logNotifications.server = {
|
proxies['logNotifications'].server = {
|
||||||
};
|
};
|
||||||
|
|
||||||
proxies.noticeboardUpdates = this.createHubProxy('noticeboardUpdates');
|
proxies['noticeboardUpdates'] = this.createHubProxy('noticeboardUpdates');
|
||||||
proxies.noticeboardUpdates.client = { };
|
proxies['noticeboardUpdates'].client = { };
|
||||||
proxies.noticeboardUpdates.server = {
|
proxies['noticeboardUpdates'].server = {
|
||||||
};
|
};
|
||||||
|
|
||||||
proxies.scheduledTaskNotifications = this.createHubProxy('scheduledTaskNotifications');
|
proxies['scheduledTaskNotifications'] = this.createHubProxy('scheduledTaskNotifications');
|
||||||
proxies.scheduledTaskNotifications.client = { };
|
proxies['scheduledTaskNotifications'].client = { };
|
||||||
proxies.scheduledTaskNotifications.server = {
|
proxies['scheduledTaskNotifications'].server = {
|
||||||
getStatus: function () {
|
getStatus: function () {
|
||||||
return proxies.scheduledTaskNotifications.invoke.apply(proxies.scheduledTaskNotifications, $.merge(["GetStatus"], $.makeArray(arguments)));
|
/// <summary>Calls the GetStatus method on the server-side scheduledTaskNotifications hub. Returns a jQuery.Deferred() promise.</summary>
|
||||||
|
return proxies['scheduledTaskNotifications'].invoke.apply(proxies['scheduledTaskNotifications'], $.merge(["GetStatus"], $.makeArray(arguments)));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
proxies.userUpdates = this.createHubProxy('userUpdates');
|
proxies['userUpdates'] = this.createHubProxy('userUpdates');
|
||||||
proxies.userUpdates.client = { };
|
proxies['userUpdates'].client = { };
|
||||||
proxies.userUpdates.server = {
|
proxies['userUpdates'].server = {
|
||||||
};
|
};
|
||||||
|
|
||||||
return proxies;
|
return proxies;
|
||||||
|
|||||||
+238
-113
@@ -1,7 +1,7 @@
|
|||||||
/* jquery.signalR.core.js */
|
/* jquery.signalR.core.js */
|
||||||
/*global window:false */
|
/*global window:false */
|
||||||
/*!
|
/*!
|
||||||
* ASP.NET SignalR JavaScript Library v2.0.3
|
* ASP.NET SignalR JavaScript Library v2.1.0
|
||||||
* http://signalr.net/
|
* http://signalr.net/
|
||||||
*
|
*
|
||||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||||
@@ -11,7 +11,6 @@
|
|||||||
/// <reference path="Scripts/jquery-1.6.4.js" />
|
/// <reference path="Scripts/jquery-1.6.4.js" />
|
||||||
/// <reference path="jquery.signalR.version.js" />
|
/// <reference path="jquery.signalR.version.js" />
|
||||||
(function ($, window, undefined) {
|
(function ($, window, undefined) {
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var resources = {
|
var resources = {
|
||||||
nojQuery: "jQuery was not found. Please ensure jQuery is referenced before the SignalR client JavaScript file.",
|
nojQuery: "jQuery was not found. Please ensure jQuery is referenced before the SignalR client JavaScript file.",
|
||||||
@@ -20,6 +19,10 @@
|
|||||||
stoppedWhileLoading: "The connection was stopped during page load.",
|
stoppedWhileLoading: "The connection was stopped during page load.",
|
||||||
stoppedWhileNegotiating: "The connection was stopped during the negotiate request.",
|
stoppedWhileNegotiating: "The connection was stopped during the negotiate request.",
|
||||||
errorParsingNegotiateResponse: "Error parsing negotiate response.",
|
errorParsingNegotiateResponse: "Error parsing negotiate response.",
|
||||||
|
errorDuringStartRequest: "Error during start request. Stopping the connection.",
|
||||||
|
stoppedDuringStartRequest: "The connection was stopped during the start request.",
|
||||||
|
errorParsingStartResponse: "Error parsing start response: '{0}'. Stopping the connection.",
|
||||||
|
invalidStartResponse: "Invalid start response: '{0}'. Stopping the connection.",
|
||||||
protocolIncompatible: "You are using a version of the client that isn't compatible with the server. Client version {0}, server version {1}.",
|
protocolIncompatible: "You are using a version of the client that isn't compatible with the server. Client version {0}, server version {1}.",
|
||||||
sendFailed: "Send failed.",
|
sendFailed: "Send failed.",
|
||||||
parseFailed: "Failed at parsing response: {0}",
|
parseFailed: "Failed at parsing response: {0}",
|
||||||
@@ -32,7 +35,9 @@
|
|||||||
pingServerFailedStatusCode: "Failed to ping server. Server responded with status code {0}, stopping the connection.",
|
pingServerFailedStatusCode: "Failed to ping server. Server responded with status code {0}, stopping the connection.",
|
||||||
pingServerFailedParse: "Failed to parse ping server response, stopping the connection.",
|
pingServerFailedParse: "Failed to parse ping server response, stopping the connection.",
|
||||||
noConnectionTransport: "Connection is in an invalid state, there is no transport active.",
|
noConnectionTransport: "Connection is in an invalid state, there is no transport active.",
|
||||||
webSocketsInvalidState: "The Web Socket transport is in an invalid state, transitioning into reconnecting."
|
webSocketsInvalidState: "The Web Socket transport is in an invalid state, transitioning into reconnecting.",
|
||||||
|
reconnectTimeout: "Couldn't reconnect within the configured timeout of {0} ms, disconnecting.",
|
||||||
|
reconnectWindowTimeout: "The client has been inactive since {0} and it has exceeded the inactivity timeout of {1} ms. Stopping the connection."
|
||||||
};
|
};
|
||||||
|
|
||||||
if (typeof ($) !== "function") {
|
if (typeof ($) !== "function") {
|
||||||
@@ -94,6 +99,11 @@
|
|||||||
return connection.state === signalR.connectionState.disconnected;
|
return connection.state === signalR.connectionState.disconnected;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
supportsKeepAlive = function (connection) {
|
||||||
|
return connection._.keepAliveData.activated &&
|
||||||
|
connection.transport.supportsKeepAlive(connection);
|
||||||
|
},
|
||||||
|
|
||||||
configureStopReconnectingTimeout = function (connection) {
|
configureStopReconnectingTimeout = function (connection) {
|
||||||
var stopReconnectingTimeout,
|
var stopReconnectingTimeout,
|
||||||
onReconnectTimeout;
|
onReconnectTimeout;
|
||||||
@@ -102,7 +112,9 @@
|
|||||||
// Without this check if a connection is stopped then started events will be bound multiple times.
|
// Without this check if a connection is stopped then started events will be bound multiple times.
|
||||||
if (!connection._.configuredStopReconnectingTimeout) {
|
if (!connection._.configuredStopReconnectingTimeout) {
|
||||||
onReconnectTimeout = function (connection) {
|
onReconnectTimeout = function (connection) {
|
||||||
connection.log("Couldn't reconnect within the configured timeout (" + connection.disconnectTimeout + "ms), disconnecting.");
|
var message = signalR._.format(signalR.resources.reconnectTimeout, connection.disconnectTimeout);
|
||||||
|
connection.log(message);
|
||||||
|
$(connection).triggerHandler(events.onError, [signalR._.error(message, /* source */ "TimeoutException")]);
|
||||||
connection.stop(/* async */ false, /* notifyServer */ false);
|
connection.stop(/* async */ false, /* notifyServer */ false);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -322,6 +334,7 @@
|
|||||||
|
|
||||||
this.url = url;
|
this.url = url;
|
||||||
this.qs = qs;
|
this.qs = qs;
|
||||||
|
this.lastError = null;
|
||||||
this._ = {
|
this._ = {
|
||||||
keepAliveData: {},
|
keepAliveData: {},
|
||||||
connectingMessageBuffer: new ConnectingMessageBuffer(this, function (message) {
|
connectingMessageBuffer: new ConnectingMessageBuffer(this, function (message) {
|
||||||
@@ -351,6 +364,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_originalJson: window.JSON,
|
||||||
|
|
||||||
json: window.JSON,
|
json: window.JSON,
|
||||||
|
|
||||||
isCrossDomain: function (url, against) {
|
isCrossDomain: function (url, against) {
|
||||||
@@ -386,7 +401,7 @@
|
|||||||
|
|
||||||
state: signalR.connectionState.disconnected,
|
state: signalR.connectionState.disconnected,
|
||||||
|
|
||||||
clientProtocol: "1.3",
|
clientProtocol: "1.4",
|
||||||
|
|
||||||
reconnectDelay: 2000,
|
reconnectDelay: 2000,
|
||||||
|
|
||||||
@@ -413,6 +428,8 @@
|
|||||||
deferred = connection._deferral || $.Deferred(), // Check to see if there is a pre-existing deferral that's being built on, if so we want to keep using it
|
deferred = connection._deferral || $.Deferred(), // Check to see if there is a pre-existing deferral that's being built on, if so we want to keep using it
|
||||||
parser = window.document.createElement("a");
|
parser = window.document.createElement("a");
|
||||||
|
|
||||||
|
connection.lastError = null;
|
||||||
|
|
||||||
// Persist the deferral so that if start is called multiple times the same deferral is used.
|
// Persist the deferral so that if start is called multiple times the same deferral is used.
|
||||||
connection._deferral = deferred;
|
connection._deferral = deferred;
|
||||||
|
|
||||||
@@ -470,14 +487,14 @@
|
|||||||
parser.href = connection.url;
|
parser.href = connection.url;
|
||||||
if (!parser.protocol || parser.protocol === ":") {
|
if (!parser.protocol || parser.protocol === ":") {
|
||||||
connection.protocol = window.document.location.protocol;
|
connection.protocol = window.document.location.protocol;
|
||||||
connection.host = window.document.location.host;
|
connection.host = parser.host || window.document.location.host;
|
||||||
connection.baseUrl = connection.protocol + "//" + connection.host;
|
|
||||||
} else {
|
} else {
|
||||||
connection.protocol = parser.protocol;
|
connection.protocol = parser.protocol;
|
||||||
connection.host = parser.host;
|
connection.host = parser.host;
|
||||||
connection.baseUrl = parser.protocol + "//" + parser.host;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
connection.baseUrl = connection.protocol + "//" + connection.host;
|
||||||
|
|
||||||
// Set the websocket protocol
|
// Set the websocket protocol
|
||||||
connection.wsProtocol = connection.protocol === "https:" ? "wss://" : "ws://";
|
connection.wsProtocol = connection.protocol === "https:" ? "wss://" : "ws://";
|
||||||
|
|
||||||
@@ -586,7 +603,7 @@
|
|||||||
|
|
||||||
window.clearTimeout(connection._.onFailedTimeoutHandle);
|
window.clearTimeout(connection._.onFailedTimeoutHandle);
|
||||||
|
|
||||||
if (transport.supportsKeepAlive && connection._.keepAliveData.activated) {
|
if (supportsKeepAlive(connection)) {
|
||||||
signalR.transports._logic.monitorKeepAlive(connection);
|
signalR.transports._logic.monitorKeepAlive(connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -646,23 +663,11 @@
|
|||||||
|
|
||||||
url = signalR.transports._logic.prepareQueryString(connection, url);
|
url = signalR.transports._logic.prepareQueryString(connection, url);
|
||||||
|
|
||||||
// Add the client version to the negotiate request. We utilize the same addQs method here
|
|
||||||
// so that it can append the clientVersion appropriately to the URL
|
|
||||||
url = signalR.transports._logic.addQs(url, {
|
|
||||||
clientProtocol: connection.clientProtocol
|
|
||||||
});
|
|
||||||
|
|
||||||
connection.log("Negotiating with '" + url + "'.");
|
connection.log("Negotiating with '" + url + "'.");
|
||||||
|
|
||||||
// Save the ajax negotiate request object so we can abort it if stop is called while the request is in flight.
|
// Save the ajax negotiate request object so we can abort it if stop is called while the request is in flight.
|
||||||
connection._.negotiateRequest = $.ajax(
|
connection._.negotiateRequest = signalR.transports._logic.ajax(connection, {
|
||||||
$.extend({}, $.signalR.ajaxDefaults, {
|
|
||||||
xhrFields: { withCredentials: connection.withCredentials },
|
|
||||||
url: url,
|
url: url,
|
||||||
type: "GET",
|
|
||||||
contentType: connection.contentType,
|
|
||||||
data: {},
|
|
||||||
dataType: connection.ajaxDataType,
|
|
||||||
error: function (error, statusText) {
|
error: function (error, statusText) {
|
||||||
// We don't want to cause any errors if we're aborting our own negotiate request.
|
// We don't want to cause any errors if we're aborting our own negotiate request.
|
||||||
if (statusText !== _negotiateAbortText) {
|
if (statusText !== _negotiateAbortText) {
|
||||||
@@ -691,6 +696,7 @@
|
|||||||
connection.id = res.ConnectionId;
|
connection.id = res.ConnectionId;
|
||||||
connection.token = res.ConnectionToken;
|
connection.token = res.ConnectionToken;
|
||||||
connection.webSocketServerUrl = res.WebSocketServerUrl;
|
connection.webSocketServerUrl = res.WebSocketServerUrl;
|
||||||
|
connection._.longPollDelay = res.LongPollDelay * 1000; // in ms
|
||||||
|
|
||||||
// Once the server has labeled the PersistentConnection as Disconnected, we should stop attempting to reconnect
|
// Once the server has labeled the PersistentConnection as Disconnected, we should stop attempting to reconnect
|
||||||
// after res.DisconnectTimeout seconds.
|
// after res.DisconnectTimeout seconds.
|
||||||
@@ -747,8 +753,7 @@
|
|||||||
|
|
||||||
initialize(transports);
|
initialize(transports);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
));
|
|
||||||
|
|
||||||
return deferred.promise();
|
return deferred.promise();
|
||||||
},
|
},
|
||||||
@@ -813,6 +818,7 @@
|
|||||||
/// <returns type="signalR" />
|
/// <returns type="signalR" />
|
||||||
var connection = this;
|
var connection = this;
|
||||||
$(connection).bind(events.onError, function (e, errorData, sendData) {
|
$(connection).bind(events.onError, function (e, errorData, sendData) {
|
||||||
|
connection.lastError = errorData;
|
||||||
// In practice 'errorData' is the SignalR built error object.
|
// In practice 'errorData' is the SignalR built error object.
|
||||||
// In practice 'sendData' is undefined for all error events except those triggered by
|
// In practice 'sendData' is undefined for all error events except those triggered by
|
||||||
// 'ajaxSend' and 'webSockets.send'.'sendData' is the original send payload.
|
// 'ajaxSend' and 'webSockets.send'.'sendData' is the original send payload.
|
||||||
@@ -882,7 +888,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Always clean up private non-timeout based state.
|
// Always clean up private non-timeout based state.
|
||||||
delete connection._deferral;
|
|
||||||
delete connection._.config;
|
delete connection._.config;
|
||||||
delete connection._.deferredStartHandler;
|
delete connection._.deferredStartHandler;
|
||||||
|
|
||||||
@@ -920,7 +925,7 @@
|
|||||||
connection.transport.abort(connection, async);
|
connection.transport.abort(connection, async);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connection.transport.supportsKeepAlive && connection._.keepAliveData.activated) {
|
if (supportsKeepAlive(connection)) {
|
||||||
signalR.transports._logic.stopMonitoringKeepAlive(connection);
|
signalR.transports._logic.stopMonitoringKeepAlive(connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -933,15 +938,20 @@
|
|||||||
delete connection._.negotiateRequest;
|
delete connection._.negotiateRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure that tryAbortStartRequest is called before connection._deferral is deleted
|
||||||
|
signalR.transports._logic.tryAbortStartRequest(connection);
|
||||||
|
|
||||||
// Trigger the disconnect event
|
// Trigger the disconnect event
|
||||||
$(connection).triggerHandler(events.onDisconnect);
|
$(connection).triggerHandler(events.onDisconnect);
|
||||||
|
|
||||||
|
delete connection._deferral;
|
||||||
delete connection.messageId;
|
delete connection.messageId;
|
||||||
delete connection.groupsToken;
|
delete connection.groupsToken;
|
||||||
delete connection.id;
|
delete connection.id;
|
||||||
delete connection._.pingIntervalId;
|
delete connection._.pingIntervalId;
|
||||||
delete connection._.lastMessageAt;
|
delete connection._.lastMessageAt;
|
||||||
delete connection._.lastActiveAt;
|
delete connection._.lastActiveAt;
|
||||||
|
delete connection._.longPollDelay;
|
||||||
|
|
||||||
// Clear out our message buffer
|
// Clear out our message buffer
|
||||||
connection._.connectingMessageBuffer.clear();
|
connection._.connectingMessageBuffer.clear();
|
||||||
@@ -979,11 +989,11 @@
|
|||||||
/// <reference path="jquery.signalR.core.js" />
|
/// <reference path="jquery.signalR.core.js" />
|
||||||
|
|
||||||
(function ($, window, undefined) {
|
(function ($, window, undefined) {
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var signalR = $.signalR,
|
var signalR = $.signalR,
|
||||||
events = $.signalR.events,
|
events = $.signalR.events,
|
||||||
changeState = $.signalR.changeState,
|
changeState = $.signalR.changeState,
|
||||||
|
startAbortText = "__Start Aborted__",
|
||||||
transportLogic;
|
transportLogic;
|
||||||
|
|
||||||
signalR.transports = {};
|
signalR.transports = {};
|
||||||
@@ -1028,36 +1038,43 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function addConnectionData(url, connectionData) {
|
function getAjaxUrl(connection, path) {
|
||||||
var appender = url.indexOf("?") !== -1 ? "&" : "?";
|
var url = connection.url + path;
|
||||||
|
|
||||||
if (connectionData) {
|
if (connection.transport) {
|
||||||
url += appender + "connectionData=" + window.encodeURIComponent(connectionData);
|
url += "?transport=" + connection.transport.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
return url;
|
return transportLogic.prepareQueryString(connection, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
transportLogic = signalR.transports._logic = {
|
transportLogic = signalR.transports._logic = {
|
||||||
|
ajax: function (connection, options) {
|
||||||
|
return $.ajax(
|
||||||
|
$.extend(/*deep copy*/ true, {}, $.signalR.ajaxDefaults, {
|
||||||
|
type: "GET",
|
||||||
|
data: {},
|
||||||
|
xhrFields: { withCredentials: connection.withCredentials },
|
||||||
|
contentType: connection.contentType,
|
||||||
|
dataType: connection.ajaxDataType
|
||||||
|
}, options));
|
||||||
|
},
|
||||||
|
|
||||||
pingServer: function (connection) {
|
pingServer: function (connection) {
|
||||||
/// <summary>Pings the server</summary>
|
/// <summary>Pings the server</summary>
|
||||||
/// <param name="connection" type="signalr">Connection associated with the server ping</param>
|
/// <param name="connection" type="signalr">Connection associated with the server ping</param>
|
||||||
/// <returns type="signalR" />
|
/// <returns type="signalR" />
|
||||||
var url, deferral = $.Deferred(), xhr;
|
var url,
|
||||||
|
xhr,
|
||||||
|
deferral = $.Deferred();
|
||||||
|
|
||||||
if (connection.transport) {
|
if (connection.transport) {
|
||||||
url = connection.url + "/ping";
|
url = connection.url + "/ping";
|
||||||
|
|
||||||
url = transportLogic.addQs(url, connection.qs);
|
url = transportLogic.addQs(url, connection.qs);
|
||||||
|
|
||||||
xhr = $.ajax(
|
xhr = transportLogic.ajax(connection, {
|
||||||
$.extend({}, $.signalR.ajaxDefaults, {
|
|
||||||
xhrFields: { withCredentials: connection.withCredentials },
|
|
||||||
url: url,
|
url: url,
|
||||||
type: "GET",
|
|
||||||
contentType: connection.contentType,
|
|
||||||
data: {},
|
|
||||||
dataType: connection.ajaxDataType,
|
|
||||||
success: function (result) {
|
success: function (result) {
|
||||||
var data;
|
var data;
|
||||||
|
|
||||||
@@ -1083,7 +1100,7 @@
|
|||||||
else {
|
else {
|
||||||
deferral.reject(
|
deferral.reject(
|
||||||
signalR._.transportError(
|
signalR._.transportError(
|
||||||
signalR._.format(signalR.resources.pingServerFailedInvalidResponse, result.responseText),
|
signalR._.format(signalR.resources.pingServerFailedInvalidResponse, result),
|
||||||
connection.transport,
|
connection.transport,
|
||||||
null /* error */,
|
null /* error */,
|
||||||
xhr
|
xhr
|
||||||
@@ -1114,9 +1131,7 @@
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
deferral.reject(
|
deferral.reject(
|
||||||
@@ -1131,9 +1146,23 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
prepareQueryString: function (connection, url) {
|
prepareQueryString: function (connection, url) {
|
||||||
url = transportLogic.addQs(url, connection.qs);
|
var preparedUrl;
|
||||||
|
|
||||||
return addConnectionData(url, connection.data);
|
// Use addQs to start since it handles the ?/& prefix for us
|
||||||
|
preparedUrl = transportLogic.addQs(url, "clientProtocol=" + connection.clientProtocol);
|
||||||
|
|
||||||
|
// Add the user-specified query string params if any
|
||||||
|
preparedUrl = transportLogic.addQs(preparedUrl, connection.qs);
|
||||||
|
|
||||||
|
if (connection.token) {
|
||||||
|
preparedUrl += "&connectionToken=" + window.encodeURIComponent(connection.token);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (connection.data) {
|
||||||
|
preparedUrl += "&connectionData=" + window.encodeURIComponent(connection.data);
|
||||||
|
}
|
||||||
|
|
||||||
|
return preparedUrl;
|
||||||
},
|
},
|
||||||
|
|
||||||
addQs: function (url, qs) {
|
addQs: function (url, qs) {
|
||||||
@@ -1165,7 +1194,7 @@
|
|||||||
/// <summary>Gets the url for making a GET based connect request</summary>
|
/// <summary>Gets the url for making a GET based connect request</summary>
|
||||||
var baseUrl = transport === "webSockets" ? "" : connection.baseUrl,
|
var baseUrl = transport === "webSockets" ? "" : connection.baseUrl,
|
||||||
url = baseUrl + connection.appRelativeUrl,
|
url = baseUrl + connection.appRelativeUrl,
|
||||||
qs = "transport=" + transport + "&connectionToken=" + window.encodeURIComponent(connection.token);
|
qs = "transport=" + transport;
|
||||||
|
|
||||||
if (connection.groupsToken) {
|
if (connection.groupsToken) {
|
||||||
qs += "&groupsToken=" + window.encodeURIComponent(connection.groupsToken);
|
qs += "&groupsToken=" + window.encodeURIComponent(connection.groupsToken);
|
||||||
@@ -1218,21 +1247,17 @@
|
|||||||
|
|
||||||
ajaxSend: function (connection, data) {
|
ajaxSend: function (connection, data) {
|
||||||
var payload = transportLogic.stringifySend(connection, data),
|
var payload = transportLogic.stringifySend(connection, data),
|
||||||
url = connection.url + "/send" + "?transport=" + connection.transport.name + "&connectionToken=" + window.encodeURIComponent(connection.token),
|
url = getAjaxUrl(connection, "/send"),
|
||||||
xhr,
|
xhr,
|
||||||
onFail = function (error, connection) {
|
onFail = function (error, connection) {
|
||||||
$(connection).triggerHandler(events.onError, [signalR._.transportError(signalR.resources.sendFailed, connection.transport, error, xhr), data]);
|
$(connection).triggerHandler(events.onError, [signalR._.transportError(signalR.resources.sendFailed, connection.transport, error, xhr), data]);
|
||||||
};
|
};
|
||||||
|
|
||||||
url = transportLogic.prepareQueryString(connection, url);
|
|
||||||
|
|
||||||
xhr = $.ajax(
|
xhr = transportLogic.ajax(connection, {
|
||||||
$.extend({}, $.signalR.ajaxDefaults, {
|
|
||||||
xhrFields: { withCredentials: connection.withCredentials },
|
|
||||||
url: url,
|
url: url,
|
||||||
type: connection.ajaxDataType === "jsonp" ? "GET" : "POST",
|
type: connection.ajaxDataType === "jsonp" ? "GET" : "POST",
|
||||||
contentType: signalR._.defaultContentType,
|
contentType: signalR._.defaultContentType,
|
||||||
dataType: connection.ajaxDataType,
|
|
||||||
data: {
|
data: {
|
||||||
data: payload
|
data: payload
|
||||||
},
|
},
|
||||||
@@ -1262,8 +1287,7 @@
|
|||||||
|
|
||||||
onFail(error, connection);
|
onFail(error, connection);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
));
|
|
||||||
|
|
||||||
return xhr;
|
return xhr;
|
||||||
},
|
},
|
||||||
@@ -1276,28 +1300,81 @@
|
|||||||
// Async by default unless explicitly overidden
|
// Async by default unless explicitly overidden
|
||||||
async = typeof async === "undefined" ? true : async;
|
async = typeof async === "undefined" ? true : async;
|
||||||
|
|
||||||
var url = connection.url + "/abort" + "?transport=" + connection.transport.name + "&connectionToken=" + window.encodeURIComponent(connection.token);
|
var url = getAjaxUrl(connection, "/abort");
|
||||||
url = transportLogic.prepareQueryString(connection, url);
|
|
||||||
|
|
||||||
$.ajax(
|
transportLogic.ajax(connection, {
|
||||||
$.extend({}, $.signalR.ajaxDefaults, {
|
|
||||||
xhrFields: { withCredentials: connection.withCredentials },
|
|
||||||
url: url,
|
url: url,
|
||||||
async: async,
|
async: async,
|
||||||
timeout: 1000,
|
timeout: 1000,
|
||||||
type: "POST",
|
type: "POST"
|
||||||
contentType: connection.contentType,
|
});
|
||||||
dataType: connection.ajaxDataType,
|
|
||||||
data: {}
|
|
||||||
}
|
|
||||||
));
|
|
||||||
|
|
||||||
connection.log("Fired ajax abort async = " + async + ".");
|
connection.log("Fired ajax abort async = " + async + ".");
|
||||||
},
|
},
|
||||||
|
|
||||||
tryInitialize: function (persistentResponse, onInitialized) {
|
tryInitialize: function (connection, persistentResponse, onInitialized) {
|
||||||
|
var startUrl,
|
||||||
|
xhr,
|
||||||
|
rejectDeferred = function (error) {
|
||||||
|
var deferred = connection._deferral;
|
||||||
|
if (deferred) {
|
||||||
|
deferred.reject(error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
triggerStartError = function (error) {
|
||||||
|
$(connection).triggerHandler(events.onError, [error]);
|
||||||
|
rejectDeferred(error);
|
||||||
|
connection.stop();
|
||||||
|
};
|
||||||
|
|
||||||
if (persistentResponse.Initialized) {
|
if (persistentResponse.Initialized) {
|
||||||
|
startUrl = getAjaxUrl(connection, "/start");
|
||||||
|
|
||||||
|
xhr = transportLogic.ajax(connection, {
|
||||||
|
url: startUrl,
|
||||||
|
success: function (result) {
|
||||||
|
var data;
|
||||||
|
|
||||||
|
try {
|
||||||
|
data = connection._parseResponse(result);
|
||||||
|
} catch (error) {
|
||||||
|
triggerStartError(signalR._.error(
|
||||||
|
signalR._.format(signalR.resources.errorParsingStartResponse, result),
|
||||||
|
error, xhr));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.Response === "started") {
|
||||||
onInitialized();
|
onInitialized();
|
||||||
|
} else {
|
||||||
|
triggerStartError(signalR._.error(
|
||||||
|
signalR._.format(signalR.resources.invalidStartResponse, result),
|
||||||
|
null /* error */, xhr));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (error, statusText) {
|
||||||
|
if (statusText !== startAbortText) {
|
||||||
|
triggerStartError(signalR._.error(
|
||||||
|
signalR.resources.errorDuringStartRequest,
|
||||||
|
error, xhr));
|
||||||
|
} else {
|
||||||
|
// Stop has been called
|
||||||
|
rejectDeferred(signalR._.error(
|
||||||
|
signalR.resources.stoppedDuringStartRequest,
|
||||||
|
null /* error */, xhr));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
connection._.startRequest = xhr;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
tryAbortStartRequest: function (connection) {
|
||||||
|
if (connection._.startRequest) {
|
||||||
|
// If the start request has already completed this will noop.
|
||||||
|
connection._.startRequest.abort(startAbortText);
|
||||||
|
delete connection._.startRequest;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -1316,14 +1393,6 @@
|
|||||||
if (minData) {
|
if (minData) {
|
||||||
data = transportLogic.maximizePersistentResponse(minData);
|
data = transportLogic.maximizePersistentResponse(minData);
|
||||||
|
|
||||||
if (data.Disconnect) {
|
|
||||||
connection.log("Disconnect command received from server.");
|
|
||||||
|
|
||||||
// Disconnected by the server
|
|
||||||
connection.stop(false, false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
transportLogic.updateGroups(connection, data.GroupsToken);
|
transportLogic.updateGroups(connection, data.GroupsToken);
|
||||||
|
|
||||||
if (data.MessageId) {
|
if (data.MessageId) {
|
||||||
@@ -1335,7 +1404,7 @@
|
|||||||
transportLogic.triggerReceived(connection, message);
|
transportLogic.triggerReceived(connection, message);
|
||||||
});
|
});
|
||||||
|
|
||||||
transportLogic.tryInitialize(data, onInitialized);
|
transportLogic.tryInitialize(connection, data, onInitialized);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -1422,8 +1491,10 @@
|
|||||||
|
|
||||||
verifyLastActive: function (connection) {
|
verifyLastActive: function (connection) {
|
||||||
if (new Date().getTime() - connection._.lastActiveAt >= connection.reconnectWindow) {
|
if (new Date().getTime() - connection._.lastActiveAt >= connection.reconnectWindow) {
|
||||||
connection.log("There has not been an active server connection for an extended period of time. Stopping connection.");
|
var message = signalR._.format(signalR.resources.reconnectWindowTimeout, new Date(connection._.lastActiveAt), connection.reconnectWindow);
|
||||||
connection.stop();
|
connection.log(message);
|
||||||
|
$(connection).triggerHandler(events.onError, [signalR._.error(message, /* source */ "TimeoutException")]);
|
||||||
|
connection.stop(/* async */ false, /* notifyServer */ false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1486,7 +1557,6 @@
|
|||||||
/// <reference path="jquery.signalR.transports.common.js" />
|
/// <reference path="jquery.signalR.transports.common.js" />
|
||||||
|
|
||||||
(function ($, window, undefined) {
|
(function ($, window, undefined) {
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var signalR = $.signalR,
|
var signalR = $.signalR,
|
||||||
events = $.signalR.events,
|
events = $.signalR.events,
|
||||||
@@ -1496,7 +1566,9 @@
|
|||||||
signalR.transports.webSockets = {
|
signalR.transports.webSockets = {
|
||||||
name: "webSockets",
|
name: "webSockets",
|
||||||
|
|
||||||
supportsKeepAlive: true,
|
supportsKeepAlive: function () {
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
send: function (connection, data) {
|
send: function (connection, data) {
|
||||||
var payload = transportLogic.stringifySend(connection, data);
|
var payload = transportLogic.stringifySend(connection, data);
|
||||||
@@ -1638,17 +1710,22 @@
|
|||||||
/// <reference path="jquery.signalR.transports.common.js" />
|
/// <reference path="jquery.signalR.transports.common.js" />
|
||||||
|
|
||||||
(function ($, window, undefined) {
|
(function ($, window, undefined) {
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var signalR = $.signalR,
|
var signalR = $.signalR,
|
||||||
events = $.signalR.events,
|
events = $.signalR.events,
|
||||||
changeState = $.signalR.changeState,
|
changeState = $.signalR.changeState,
|
||||||
transportLogic = signalR.transports._logic;
|
transportLogic = signalR.transports._logic,
|
||||||
|
clearReconnectAttemptTimeout = function (connection) {
|
||||||
|
window.clearTimeout(connection._.reconnectAttemptTimeoutHandle);
|
||||||
|
delete connection._.reconnectAttemptTimeoutHandle;
|
||||||
|
};
|
||||||
|
|
||||||
signalR.transports.serverSentEvents = {
|
signalR.transports.serverSentEvents = {
|
||||||
name: "serverSentEvents",
|
name: "serverSentEvents",
|
||||||
|
|
||||||
supportsKeepAlive: true,
|
supportsKeepAlive: function () {
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
timeOut: 3000,
|
timeOut: 3000,
|
||||||
|
|
||||||
@@ -1657,8 +1734,7 @@
|
|||||||
opened = false,
|
opened = false,
|
||||||
$connection = $(connection),
|
$connection = $(connection),
|
||||||
reconnecting = !onSuccess,
|
reconnecting = !onSuccess,
|
||||||
url,
|
url;
|
||||||
reconnectTimeout;
|
|
||||||
|
|
||||||
if (connection.eventSource) {
|
if (connection.eventSource) {
|
||||||
connection.log("The connection already has an event source. Stopping it.");
|
connection.log("The connection already has an event source. Stopping it.");
|
||||||
@@ -1695,7 +1771,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (reconnecting) {
|
if (reconnecting) {
|
||||||
reconnectTimeout = window.setTimeout(function () {
|
connection._.reconnectAttemptTimeoutHandle = window.setTimeout(function () {
|
||||||
if (opened === false) {
|
if (opened === false) {
|
||||||
// If we're reconnecting and the event source is attempting to connect,
|
// If we're reconnecting and the event source is attempting to connect,
|
||||||
// don't keep retrying. This causes duplicate connections to spawn.
|
// don't keep retrying. This causes duplicate connections to spawn.
|
||||||
@@ -1711,10 +1787,7 @@
|
|||||||
connection.eventSource.addEventListener("open", function (e) {
|
connection.eventSource.addEventListener("open", function (e) {
|
||||||
connection.log("EventSource connected.");
|
connection.log("EventSource connected.");
|
||||||
|
|
||||||
if (reconnectTimeout) {
|
clearReconnectAttemptTimeout(connection);
|
||||||
window.clearTimeout(reconnectTimeout);
|
|
||||||
}
|
|
||||||
|
|
||||||
transportLogic.clearReconnectTimeout(connection);
|
transportLogic.clearReconnectTimeout(connection);
|
||||||
|
|
||||||
if (opened === false) {
|
if (opened === false) {
|
||||||
@@ -1794,6 +1867,7 @@
|
|||||||
|
|
||||||
stop: function (connection) {
|
stop: function (connection) {
|
||||||
// Don't trigger a reconnect after stopping
|
// Don't trigger a reconnect after stopping
|
||||||
|
clearReconnectAttemptTimeout(connection);
|
||||||
transportLogic.clearReconnectTimeout(connection);
|
transportLogic.clearReconnectTimeout(connection);
|
||||||
|
|
||||||
if (connection && connection.eventSource) {
|
if (connection && connection.eventSource) {
|
||||||
@@ -1817,7 +1891,6 @@
|
|||||||
/// <reference path="jquery.signalR.transports.common.js" />
|
/// <reference path="jquery.signalR.transports.common.js" />
|
||||||
|
|
||||||
(function ($, window, undefined) {
|
(function ($, window, undefined) {
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var signalR = $.signalR,
|
var signalR = $.signalR,
|
||||||
events = $.signalR.events,
|
events = $.signalR.events,
|
||||||
@@ -1872,7 +1945,9 @@
|
|||||||
signalR.transports.foreverFrame = {
|
signalR.transports.foreverFrame = {
|
||||||
name: "foreverFrame",
|
name: "foreverFrame",
|
||||||
|
|
||||||
supportsKeepAlive: true,
|
supportsKeepAlive: function () {
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
// Added as a value here so we can create tests to verify functionality
|
// Added as a value here so we can create tests to verify functionality
|
||||||
iframeClearThreshold: 50,
|
iframeClearThreshold: 50,
|
||||||
@@ -1962,9 +2037,21 @@
|
|||||||
|
|
||||||
receive: function (connection, data) {
|
receive: function (connection, data) {
|
||||||
var cw,
|
var cw,
|
||||||
body;
|
body,
|
||||||
|
response;
|
||||||
|
|
||||||
transportLogic.processMessages(connection, data, connection.onSuccess);
|
if (connection.json !== connection._originalJson) {
|
||||||
|
// If there's a custom JSON parser configured then serialize the object
|
||||||
|
// using the original (browser) JSON parser and then deserialize it using
|
||||||
|
// the custom parser (connection._parseResponse does that). This is so we
|
||||||
|
// can easily send the response from the server as "raw" JSON but still
|
||||||
|
// support custom JSON deserialization in the browser.
|
||||||
|
data = connection._originalJson.stringify(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
response = connection._parseResponse(data);
|
||||||
|
|
||||||
|
transportLogic.processMessages(connection, response, connection.onSuccess);
|
||||||
|
|
||||||
// Protect against connection stopping from a callback trigger within the processMessages above.
|
// Protect against connection stopping from a callback trigger within the processMessages above.
|
||||||
if (connection.state === $.signalR.connectionState.connected) {
|
if (connection.state === $.signalR.connectionState.connected) {
|
||||||
@@ -2048,18 +2135,33 @@
|
|||||||
/// <reference path="jquery.signalR.transports.common.js" />
|
/// <reference path="jquery.signalR.transports.common.js" />
|
||||||
|
|
||||||
(function ($, window, undefined) {
|
(function ($, window, undefined) {
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var signalR = $.signalR,
|
var signalR = $.signalR,
|
||||||
events = $.signalR.events,
|
events = $.signalR.events,
|
||||||
changeState = $.signalR.changeState,
|
changeState = $.signalR.changeState,
|
||||||
isDisconnecting = $.signalR.isDisconnecting,
|
isDisconnecting = $.signalR.isDisconnecting,
|
||||||
transportLogic = signalR.transports._logic;
|
transportLogic = signalR.transports._logic,
|
||||||
|
browserSupportsXHRProgress = (function () {
|
||||||
|
try {
|
||||||
|
return "onprogress" in new window.XMLHttpRequest();
|
||||||
|
} catch (e) {
|
||||||
|
// No XHR means no XHR progress event
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
signalR.transports.longPolling = {
|
signalR.transports.longPolling = {
|
||||||
name: "longPolling",
|
name: "longPolling",
|
||||||
|
|
||||||
supportsKeepAlive: false,
|
supportsKeepAlive: function (connection) {
|
||||||
|
return browserSupportsXHRProgress &&
|
||||||
|
connection.ajaxDataType !== "jsonp" &&
|
||||||
|
// Don't check for keep alives if there is a delay configured between poll requests.
|
||||||
|
// Don't check for keep alives if the server didn't send back the "LongPollDelay" as
|
||||||
|
// part of the response to /negotiate. That indicates the server is running an older
|
||||||
|
// version of SignalR that doesn't send long polling keep alives.
|
||||||
|
connection._.longPollDelay === 0;
|
||||||
|
},
|
||||||
|
|
||||||
reconnectDelay: 3000,
|
reconnectDelay: 3000,
|
||||||
|
|
||||||
@@ -2070,10 +2172,11 @@
|
|||||||
fireConnect = function () {
|
fireConnect = function () {
|
||||||
fireConnect = $.noop;
|
fireConnect = $.noop;
|
||||||
|
|
||||||
connection.log("LongPolling connected.");
|
|
||||||
onSuccess();
|
|
||||||
// Reset onFailed to null because it shouldn't be called again
|
// Reset onFailed to null because it shouldn't be called again
|
||||||
onFailed = null;
|
onFailed = null;
|
||||||
|
|
||||||
|
connection.log("LongPolling connected.");
|
||||||
|
onSuccess();
|
||||||
},
|
},
|
||||||
tryFailConnect = function () {
|
tryFailConnect = function () {
|
||||||
if (onFailed) {
|
if (onFailed) {
|
||||||
@@ -2125,13 +2228,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
connection.log("Opening long polling request to '" + url + "'.");
|
connection.log("Opening long polling request to '" + url + "'.");
|
||||||
instance.pollXhr = $.ajax(
|
instance.pollXhr = transportLogic.ajax(connection, {
|
||||||
$.extend({}, $.signalR.ajaxDefaults, {
|
xhrFields: {
|
||||||
xhrFields: { withCredentials: connection.withCredentials },
|
onprogress: function () {
|
||||||
|
transportLogic.markLastMessage(connection);
|
||||||
|
}
|
||||||
|
},
|
||||||
url: url,
|
url: url,
|
||||||
type: "GET",
|
|
||||||
dataType: connection.ajaxDataType,
|
|
||||||
contentType: connection.contentType,
|
|
||||||
success: function (result) {
|
success: function (result) {
|
||||||
var minData,
|
var minData,
|
||||||
delay = 0,
|
delay = 0,
|
||||||
@@ -2145,6 +2248,7 @@
|
|||||||
reconnectErrors = 0;
|
reconnectErrors = 0;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// Remove any keep-alives from the beginning of the result
|
||||||
minData = connection._parseResponse(result);
|
minData = connection._parseResponse(result);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
@@ -2239,9 +2343,7 @@
|
|||||||
}, that.reconnectDelay);
|
}, that.reconnectDelay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
));
|
|
||||||
|
|
||||||
|
|
||||||
// This will only ever pass after an error has occured via the poll ajax procedure.
|
// This will only ever pass after an error has occured via the poll ajax procedure.
|
||||||
if (reconnecting && raiseReconnect === true) {
|
if (reconnecting && raiseReconnect === true) {
|
||||||
@@ -2257,7 +2359,9 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
lostConnection: function (connection) {
|
lostConnection: function (connection) {
|
||||||
throw new Error("Lost Connection not handled for LongPolling");
|
if (connection.pollXhr) {
|
||||||
|
connection.pollXhr.abort("lostConnection");
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
send: function (connection, data) {
|
send: function (connection, data) {
|
||||||
@@ -2294,7 +2398,6 @@
|
|||||||
/// <reference path="jquery.signalR.core.js" />
|
/// <reference path="jquery.signalR.core.js" />
|
||||||
|
|
||||||
(function ($, window, undefined) {
|
(function ($, window, undefined) {
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var eventNamespace = ".hubProxy",
|
var eventNamespace = ".hubProxy",
|
||||||
signalR = $.signalR;
|
signalR = $.signalR;
|
||||||
@@ -2457,7 +2560,15 @@
|
|||||||
// Update the hub state
|
// Update the hub state
|
||||||
$.extend(that.state, result.State);
|
$.extend(that.state, result.State);
|
||||||
|
|
||||||
if (result.Error) {
|
if (result.Progress) {
|
||||||
|
if (d.notifyWith) {
|
||||||
|
// Progress is only supported in jQuery 1.7+
|
||||||
|
d.notifyWith(that, [result.Progress.Data]);
|
||||||
|
} else if(!connection._.progressjQueryVersionLogged) {
|
||||||
|
connection.log("A hub method invocation progress update was received but the version of jQuery in use (" + $.prototype.jquery + ") does not support progress updates. Upgrade to jQuery 1.7+ to receive progress notifications.");
|
||||||
|
connection._.progressjQueryVersionLogged = true;
|
||||||
|
}
|
||||||
|
} else if (result.Error) {
|
||||||
// Server hub method threw an exception, log it & reject the deferred
|
// Server hub method threw an exception, log it & reject the deferred
|
||||||
if (result.StackTrace) {
|
if (result.StackTrace) {
|
||||||
connection.log(result.Error + "\n" + result.StackTrace + ".");
|
connection.log(result.Error + "\n" + result.StackTrace + ".");
|
||||||
@@ -2494,6 +2605,10 @@
|
|||||||
return {
|
return {
|
||||||
State: minHubResponse.S,
|
State: minHubResponse.S,
|
||||||
Result: minHubResponse.R,
|
Result: minHubResponse.R,
|
||||||
|
Progress: minHubResponse.P ? {
|
||||||
|
Id: minHubResponse.P.I,
|
||||||
|
Data: minHubResponse.P.D
|
||||||
|
} : null,
|
||||||
Id: minHubResponse.I,
|
Id: minHubResponse.I,
|
||||||
IsHubException: minHubResponse.H,
|
IsHubException: minHubResponse.H,
|
||||||
Error: minHubResponse.E,
|
Error: minHubResponse.E,
|
||||||
@@ -2552,7 +2667,17 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof (minData.I) !== "undefined") {
|
// We have to handle progress updates first in order to ensure old clients that receive
|
||||||
|
// progress updates enter the return value branch and then no-op when they can't find
|
||||||
|
// the callback in the map (because the minData.I value will not be a valid callback ID)
|
||||||
|
if (typeof (minData.P) !== "undefined") {
|
||||||
|
// Process progress notification
|
||||||
|
dataCallbackId = minData.P.I.toString();
|
||||||
|
callback = connection._.invocationCallbacks[dataCallbackId];
|
||||||
|
if (callback) {
|
||||||
|
callback.method.call(callback.scope, minData);
|
||||||
|
}
|
||||||
|
} else if (typeof (minData.I) !== "undefined") {
|
||||||
// We received the return value from a server method invocation, look up callback by id and call it
|
// We received the return value from a server method invocation, look up callback by id and call it
|
||||||
dataCallbackId = minData.I.toString();
|
dataCallbackId = minData.I.toString();
|
||||||
callback = connection._.invocationCallbacks[dataCallbackId];
|
callback = connection._.invocationCallbacks[dataCallbackId];
|
||||||
@@ -2689,5 +2814,5 @@
|
|||||||
/*global window:false */
|
/*global window:false */
|
||||||
/// <reference path="jquery.signalR.core.js" />
|
/// <reference path="jquery.signalR.core.js" />
|
||||||
(function ($, undefined) {
|
(function ($, undefined) {
|
||||||
$.signalR.version = "2.0.3";
|
$.signalR.version = "2.1.0";
|
||||||
}(window.jQuery));
|
}(window.jQuery));
|
||||||
@@ -46,12 +46,13 @@
|
|||||||
<Reference Include="MarkdownSharp">
|
<Reference Include="MarkdownSharp">
|
||||||
<HintPath>..\packages\MarkdownSharp.1.13.0.0\lib\35\MarkdownSharp.dll</HintPath>
|
<HintPath>..\packages\MarkdownSharp.1.13.0.0\lib\35\MarkdownSharp.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.AspNet.SignalR.Core, Version=2.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.AspNet.SignalR.Core, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\packages\Microsoft.AspNet.SignalR.Core.2.0.3\lib\net45\Microsoft.AspNet.SignalR.Core.dll</HintPath>
|
<HintPath>..\packages\Microsoft.AspNet.SignalR.Core.2.1.0\lib\net45\Microsoft.AspNet.SignalR.Core.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.AspNet.SignalR.SystemWeb">
|
<Reference Include="Microsoft.AspNet.SignalR.SystemWeb, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Microsoft.AspNet.SignalR.SystemWeb.2.0.3\lib\net45\Microsoft.AspNet.SignalR.SystemWeb.dll</HintPath>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\packages\Microsoft.AspNet.SignalR.SystemWeb.2.1.0\lib\net45\Microsoft.AspNet.SignalR.SystemWeb.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="Microsoft.Owin, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Owin, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
@@ -2073,7 +2074,6 @@
|
|||||||
<None Include="T4MVC.tt.settings.xml" />
|
<None Include="T4MVC.tt.settings.xml" />
|
||||||
<None Include="ClientSource\Scripts\Core\jquery.validate.js" />
|
<None Include="ClientSource\Scripts\Core\jquery.validate.js" />
|
||||||
<None Include="ClientSource\Scripts\Core\jquery.validate.unobtrusive.js" />
|
<None Include="ClientSource\Scripts\Core\jquery.validate.unobtrusive.js" />
|
||||||
<None Include="ClientSource\Scripts\Modules\jQuery-SignalR\jquery.signalR-2.0.3.js" />
|
|
||||||
<None Include="ClientSource\Scripts\Modules\Knockout\knockout-3.1.0.js" />
|
<None Include="ClientSource\Scripts\Modules\Knockout\knockout-3.1.0.js" />
|
||||||
<None Include="ClientSource\Scripts\Core\modernizr-2.7.2.js" />
|
<None Include="ClientSource\Scripts\Core\modernizr-2.7.2.js" />
|
||||||
<None Include="ClientSource\Scripts\Core\jquery-ui-1.10.4.js" />
|
<None Include="ClientSource\Scripts\Core\jquery-ui-1.10.4.js" />
|
||||||
@@ -2087,6 +2087,7 @@
|
|||||||
<None Include="ClientSource\Scripts\Modules\tinymce\themes\modern\theme.min.js" />
|
<None Include="ClientSource\Scripts\Modules\tinymce\themes\modern\theme.min.js" />
|
||||||
<None Include="ClientSource\Scripts\Modules\tinymce\tinymce.js" />
|
<None Include="ClientSource\Scripts\Modules\tinymce\tinymce.js" />
|
||||||
<None Include="ClientSource\Scripts\Modules\tinymce\tinymce.min.js" />
|
<None Include="ClientSource\Scripts\Modules\tinymce\tinymce.min.js" />
|
||||||
|
<Content Include="ClientSource\Scripts\Modules\jQuery-SignalR\jquery.signalR-2.1.0.js" />
|
||||||
<Content Include="Web.config">
|
<Content Include="Web.config">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Content>
|
</Content>
|
||||||
@@ -2176,7 +2177,7 @@
|
|||||||
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
|
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
|
||||||
</WebProjectProperties>
|
</WebProjectProperties>
|
||||||
</FlavorProperties>
|
</FlavorProperties>
|
||||||
<UserProperties BuildVersion_StartDate="2011/7/1" BuildVersion_BuildAction="Both" BuildVersion_UseGlobalSettings="False" BuildVersion_DetectChanges="False" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_UpdateFileVersion="True" />
|
<UserProperties BuildVersion_UpdateFileVersion="True" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_DetectChanges="False" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildAction="Both" BuildVersion_StartDate="2011/7/1" />
|
||||||
</VisualStudio>
|
</VisualStudio>
|
||||||
</ProjectExtensions>
|
</ProjectExtensions>
|
||||||
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
|
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
|
||||||
|
|||||||
@@ -12,10 +12,10 @@
|
|||||||
<package id="MarkdownSharp" version="1.13.0.0" targetFramework="net45" />
|
<package id="MarkdownSharp" version="1.13.0.0" targetFramework="net45" />
|
||||||
<package id="Microsoft.AspNet.Mvc" version="4.0.30506.0" targetFramework="net45" />
|
<package id="Microsoft.AspNet.Mvc" version="4.0.30506.0" targetFramework="net45" />
|
||||||
<package id="Microsoft.AspNet.Razor" version="2.0.30506.0" targetFramework="net45" />
|
<package id="Microsoft.AspNet.Razor" version="2.0.30506.0" targetFramework="net45" />
|
||||||
<package id="Microsoft.AspNet.SignalR" version="2.0.3" targetFramework="net45" />
|
<package id="Microsoft.AspNet.SignalR" version="2.1.0" targetFramework="net45" />
|
||||||
<package id="Microsoft.AspNet.SignalR.Core" version="2.0.3" targetFramework="net45" />
|
<package id="Microsoft.AspNet.SignalR.Core" version="2.1.0" targetFramework="net45" />
|
||||||
<package id="Microsoft.AspNet.SignalR.JS" version="2.0.3" targetFramework="net45" />
|
<package id="Microsoft.AspNet.SignalR.JS" version="2.1.0" targetFramework="net45" />
|
||||||
<package id="Microsoft.AspNet.SignalR.SystemWeb" version="2.0.3" targetFramework="net45" />
|
<package id="Microsoft.AspNet.SignalR.SystemWeb" version="2.1.0" targetFramework="net45" />
|
||||||
<package id="Microsoft.AspNet.WebApi" version="4.0.30506.0" targetFramework="net45" />
|
<package id="Microsoft.AspNet.WebApi" version="4.0.30506.0" targetFramework="net45" />
|
||||||
<package id="Microsoft.AspNet.WebApi.Client" version="4.0.30506.0" targetFramework="net45" />
|
<package id="Microsoft.AspNet.WebApi.Client" version="4.0.30506.0" targetFramework="net45" />
|
||||||
<package id="Microsoft.AspNet.WebApi.Core" version="4.0.30506.0" targetFramework="net45" />
|
<package id="Microsoft.AspNet.WebApi.Core" version="4.0.30506.0" targetFramework="net45" />
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{FE0E88
|
|||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
.nuget\NuGet.Config = .nuget\NuGet.Config
|
.nuget\NuGet.Config = .nuget\NuGet.Config
|
||||||
.nuget\NuGet.exe = .nuget\NuGet.exe
|
.nuget\NuGet.exe = .nuget\NuGet.exe
|
||||||
.nuget\NuGet.targets = .nuget\NuGet.targets
|
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
@@ -121,12 +120,12 @@ Global
|
|||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
BuildVersion_BuildAction = Both
|
|
||||||
BuildVersion_StartDate = 2001/1/1
|
|
||||||
BuildVersion_BuildVersioningStyle = None.None.None.None
|
|
||||||
BuildVersion_UpdateAssemblyVersion = False
|
|
||||||
BuildVersion_UpdateFileVersion = False
|
|
||||||
BuildVersion_DetectChanges = True
|
|
||||||
BuildVersion_UseGlobalSettings = False
|
BuildVersion_UseGlobalSettings = False
|
||||||
|
BuildVersion_DetectChanges = True
|
||||||
|
BuildVersion_UpdateFileVersion = False
|
||||||
|
BuildVersion_UpdateAssemblyVersion = False
|
||||||
|
BuildVersion_BuildVersioningStyle = None.None.None.None
|
||||||
|
BuildVersion_StartDate = 2001/1/1
|
||||||
|
BuildVersion_BuildAction = Both
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|||||||
Reference in New Issue
Block a user