/*!
* ASP.NET SignalR JavaScript Library v2.1.2
* //signalr.net/
*
* Copyright Microsoft Open Technologies, Inc. All rights reserved.
* Licensed under the Apache 2.0
* //github.com/SignalR/SignalR/blob/master/LICENSE.md
*
*/
///
///
(function ($, window, undefined) {
///
"use strict";
if (typeof ($.signalR) !== "function") {
throw new Error("SignalR: SignalR is not loaded. Please ensure jquery.signalR-x.js is referenced before ~/signalr/js.");
}
var signalR = $.signalR;
function makeProxyCallback(hub, callback) {
return function () {
// Call the client hub method
callback.apply(hub, $.makeArray(arguments));
};
}
function registerHubProxies(instance, shouldSubscribe) {
var key, hub, memberKey, memberValue, subscriptionMethod;
for (key in instance) {
if (instance.hasOwnProperty(key)) {
hub = instance[key];
if (!(hub.hubName)) {
// Not a client hub
continue;
}
if (shouldSubscribe) {
// We want to subscribe to the hub events
subscriptionMethod = hub.on;
} else {
// We want to unsubscribe from the hub events
subscriptionMethod = hub.off;
}
// Loop through all members on the hub and find client hub functions to subscribe/unsubscribe
for (memberKey in hub.client) {
if (hub.client.hasOwnProperty(memberKey)) {
memberValue = hub.client[memberKey];
if (!$.isFunction(memberValue)) {
// Not a client hub function
continue;
}
subscriptionMethod.call(hub, memberKey, makeProxyCallback(hub, memberValue));
}
}
}
}
}
$.hubConnection.prototype.createHubProxies = function () {
var proxies = {};
this.starting(function () {
// Register the hub proxies as subscribed
// (instance, shouldSubscribe)
registerHubProxies(proxies, true);
this._registerSubscribedHubs();
}).disconnected(function () {
// Unsubscribe all hub proxies when we "disconnect". This is to ensure that we do not re-add functional call backs.
// (instance, shouldSubscribe)
registerHubProxies(proxies, false);
});
proxies['chatHub'] = this.createHubProxy('chatHub');
proxies['chatHub'].client = { };
proxies['chatHub'].server = {
adminRequest: function (pass) {
return proxies['chatHub'].invoke.apply(proxies['chatHub'], $.merge(["AdminRequest"], $.makeArray(arguments)));
},
agentConnect: function (name, pass) {
return proxies['chatHub'].invoke.apply(proxies['chatHub'], $.merge(["AgentConnect"], $.makeArray(arguments)));
},
changeStatus: function (online) {
return proxies['chatHub'].invoke.apply(proxies['chatHub'], $.merge(["ChangeStatus"], $.makeArray(arguments)));
},
closeChat: function (id) {
return proxies['chatHub'].invoke.apply(proxies['chatHub'], $.merge(["CloseChat"], $.makeArray(arguments)));
},
engageVisitor: function (connectionId) {
return proxies['chatHub'].invoke.apply(proxies['chatHub'], $.merge(["EngageVisitor"], $.makeArray(arguments)));
},
getInstallState: function () {
return proxies['chatHub'].invoke.apply(proxies['chatHub'], $.merge(["getInstallState"], $.makeArray(arguments)));
},
leaveChat: function (id) {
return proxies['chatHub'].invoke.apply(proxies['chatHub'], $.merge(["LeaveChat"], $.makeArray(arguments)));
},
logVisit: function (page, referrer, existingChatId) {
return proxies['chatHub'].invoke.apply(proxies['chatHub'], $.merge(["LogVisit"], $.makeArray(arguments)));
},
message: function (mess) {
return proxies['chatHub'].invoke.apply(proxies['chatHub'], $.merge(["message"], $.makeArray(arguments)));
},
opSend: function (id, data) {
return proxies['chatHub'].invoke.apply(proxies['chatHub'], $.merge(["OpSend"], $.makeArray(arguments)));
},
requestChat: function (message) {
return proxies['chatHub'].invoke.apply(proxies['chatHub'], $.merge(["RequestChat"], $.makeArray(arguments)));
},
send: function (data) {
return proxies['chatHub'].invoke.apply(proxies['chatHub'], $.merge(["Send"], $.makeArray(arguments)));
},
sendEmail: function (from, message) {
return proxies['chatHub'].invoke.apply(proxies['chatHub'], $.merge(["SendEmail"], $.makeArray(arguments)));
},
sendPrivateMessage: function (toUserId, message) {
return proxies['chatHub'].invoke.apply(proxies['chatHub'], $.merge(["SendPrivateMessage"], $.makeArray(arguments)));
},
setConfig: function (token, adminPass, agentPass) {
return proxies['chatHub'].invoke.apply(proxies['chatHub'], $.merge(["SetConfig"], $.makeArray(arguments)));
},
toHash: function (password) {
return proxies['chatHub'].invoke.apply(proxies['chatHub'], $.merge(["ToHash"], $.makeArray(arguments)));
},
transfer: function (connectionId, agentName, messages) {
return proxies['chatHub'].invoke.apply(proxies['chatHub'], $.merge(["Transfer"], $.makeArray(arguments)));
}
};
return proxies;
};
signalR.hub = $.hubConnection("/signalr", { useDefaultPath: false });
$.extend(signalR, signalR.hub.createHubProxies());
}(window.jQuery, window));