Created
January 4, 2013 01:51
-
-
Save markus101/4449254 to your computer and use it in GitHub Desktop.
SignalR, xsp4 under Windows8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* SignalR JavaScript Library v0.5.3.3.3 | |
* http://signalr.net/ | |
* | |
* Copyright David Fowler and Damian Edwards 2012 | |
* Licensed under the MIT. | |
* https://github.com/SignalR/SignalR/blob/master/LICENSE.md | |
* | |
*/ | |
/// <reference path="..\..\SignalR.Client.JS\Scripts\jquery-1.6.2.js" /> | |
/// <reference path="jquery.signalR.js" /> | |
(function ($, window) { | |
/// <param name="$" type="jQuery" /> | |
"use strict"; | |
if (typeof ($.signalR) !== "function") { | |
throw "SignalR: SignalR is not loaded. Please ensure jquery.signalR-x.js is referenced before ~/signalr/hubs."; | |
} | |
var signalR = $.signalR; | |
function makeProxyCallback(hub, callback) { | |
return function () { | |
updateHubState(hub, this.state); | |
// Call the client hub method | |
callback.apply(hub, $.makeArray(arguments)); | |
}; | |
} | |
function updateHubState(hub, newState) { | |
var oldState = hub._.oldState; | |
if (!oldState) { | |
// First time updating client state, just copy it all over | |
$.extend(hub, newState); | |
hub._.oldState = $.extend({}, newState); | |
return; | |
} | |
// Compare the old client state to current client state and preserve any changes | |
for (var key in newState) { | |
if (typeof (oldState[key]) !== "undefined" && oldState[key] === newState[key]) { | |
// Key is different between old state and new state thus it's changed locally | |
continue; | |
} | |
hub[key] = newState[key]; | |
hub._.oldState[key] = newState[key]; | |
} | |
} | |
function createHubProxies(instance, hubConnection) { | |
var key, hub, memberKey, memberValue, proxy; | |
for (key in instance) { | |
if (instance.hasOwnProperty(key)) { | |
hub = instance[key]; | |
if (!(hub._ && hub._.hubName)) { | |
// Not a client hub | |
continue; | |
} | |
// Create and store the hub proxy | |
hub._.proxy = hubConnection.createProxy(hub._.hubName); | |
// Loop through all members on the hub and find client hub functions to subscribe to | |
for (memberKey in hub) { | |
if (hub.hasOwnProperty(memberKey)) { | |
memberValue = hub[memberKey]; | |
if (memberKey === "_" || $.type(memberValue) !== "function" | |
|| $.inArray(memberKey, hub._.ignoreMembers) >= 0) { | |
// Not a client hub function | |
continue; | |
} | |
// Subscribe to the hub event for this method | |
hub._.proxy.on(memberKey, makeProxyCallback(hub, memberValue)); | |
} | |
} | |
} | |
} | |
} | |
function copy(obj, exclude) { | |
var newObj = {}; | |
$.each(obj, function (key, value) { | |
if (!$.isFunction(value) && $.inArray(key, exclude) === -1) { | |
// We don't use "this" because browsers suck! | |
newObj[key] = value; | |
} | |
}); | |
return newObj; | |
} | |
function invoke(hub, methodName, args) { | |
// Extract user callback from args | |
var userCallback = args[args.length - 1], // last argument | |
callback, | |
connection = hub._.connection(); | |
if ($.isFunction(userCallback)) { | |
// Replace user's callback with our own | |
callback = function (result) { | |
// Update hub state from proxy state | |
$.extend(hub, hub._.proxy.state); | |
if ($.isFunction(userCallback)) { | |
userCallback.call(hub, result); | |
} | |
}; | |
args = $.merge(args.splice(0, args.length - 1), [callback]); | |
} | |
if (!hub._.proxy) { | |
if (connection.state === signalR.connectionState.disconnected) { | |
// Connection hasn't been started yet | |
throw "SignalR: Connection must be started before data can be sent. Call .start() before .send()"; | |
} | |
if (connection.state === signalR.connectionState.connecting) { | |
// Connection hasn't been started yet | |
throw "SignalR: Connection has not been fully initialized. Use .start().done() or .start().fail() to run logic after the connection has started."; | |
} | |
} | |
// Update proxy state from hub state | |
$.extend(hub._.proxy.state, copy(hub, ["_"])); | |
return hub._.proxy.invoke.apply(hub._.proxy, $.merge([methodName], args)); | |
} | |
signalR.episodeHub = { | |
_: { | |
hubName: 'EpisodeHub', | |
ignoreMembers: [], | |
connection: function () { return signalR.hub; } | |
} | |
}; | |
signalR.hub = $.hubConnection("/signalr") | |
.starting(function () { | |
createHubProxies(signalR, this); | |
}); | |
}(window.jQuery, window));<?xml version="1.0" ?> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><title>Error 500</title><style type="text/css">body {font-family:"Verdana","DejaVu Sans",sans-serif;font-weight:normal;font-size: .7em;color:black;background-color: white} | |
p {font-family:"Verdana","DejaVu Sans",sans-serif;font-weight:normal;color:black;margin-top: -5px} | |
b {font-family:"Verdana","DejaVu Sans",sans-serif;font-weight:bold;color:black;margin-top: -5px} | |
h1 { font-family:"Verdana","DejaVu Sans",sans-serif;font-weight:normal;font-size:18pt;color:red } | |
h2 { font-family:"Verdana","DejaVu Sans",sans-serif;font-weight:normal;font-size:14pt;color:maroon } | |
pre,code {font-family:"Lucida Console","DejaVu Sans Mono",monospace;font-size: 0.9em,white-space: pre-line} | |
div.bodyText {font-family: "Verdana","DejaVu Sans",sans-serif} | |
table.sampleCode {width: 100%; background-color: #ffffcc; } | |
.errorText {color: red; font-weight: bold} | |
.marker {font-weight: bold; color: black;text-decoration: none;} | |
.version {color: gray;} | |
.error {margin-bottom: 10px;} | |
.expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:pointer; }</style></head><body><h1>Server Error in '/' Application</h1><hr style="color: silver"/><h2><em>Object reference not set to an instance of an object</em></h2> | |
<p><strong>Description: </strong>HTTP 500. Error processing request.</p> | |
<p><strong>Stack Trace: </strong></p><table summary="Stack Trace" class="sampleCode"> | |
<tr><td><pre>System.NullReferenceException: Object reference not set to an instance of an object<br /> at Autofac.Integration.Mvc.RequestLifetimeScopeProvider.get_LifetimeScope () [0x00000] in <filename unknown>:0 <br /> at Autofac.Integration.Mvc.RequestLifetimeScopeProvider.EndLifetimeScope () [0x00000] in <filename unknown>:0 <br /> at Autofac.Integration.Mvc.RequestLifetimeHttpModule.OnEndRequest (System.Object sender, System.EventArgs e) [0x00000] in <filename unknown>:0 <br /> at (wrapper delegate-invoke) <Module>:invoke_void__this___object_EventArgs (object,System.EventArgs)<br /> at (wrapper delegate-invoke) <Module>:invoke_void__this___object_EventArgs (object,System.EventArgs)<br /> at (wrapper delegate-invoke) <Module>:invoke_void__this___object_EventArgs (object,System.EventArgs)<br /> at (wrapper delegate-invoke) <Module>:invoke_void__this___object_EventArgs (object,System.EventArgs)<br /> at System.Web.HttpApplication.PipelineDone () [0x00000] in <filename unknown>:0 </pre></td></tr> | |
</table> | |
<hr style="color: silver"/><strong>Version information: </strong> Mono Runtime Version: <tt>2.10.9 (tarball)</tt>; ASP.NET Version: <tt>4.0.30319.1</tt></body></html> | |
<!-- | |
[System.NullReferenceException]: Object reference not set to an instance of an object | |
at Autofac.Integration.Mvc.RequestLifetimeScopeProvider.get_LifetimeScope () [0x00000] in <filename unknown>:0 | |
at Autofac.Integration.Mvc.RequestLifetimeScopeProvider.EndLifetimeScope () [0x00000] in <filename unknown>:0 | |
at Autofac.Integration.Mvc.RequestLifetimeHttpModule.OnEndRequest (System.Object sender, System.EventArgs e) [0x00000] in <filename unknown>:0 | |
at (wrapper delegate-invoke) <Module>:invoke_void__this___object_EventArgs (object,System.EventArgs) | |
at (wrapper delegate-invoke) <Module>:invoke_void__this___object_EventArgs (object,System.EventArgs) | |
at (wrapper delegate-invoke) <Module>:invoke_void__this___object_EventArgs (object,System.EventArgs) | |
at (wrapper delegate-invoke) <Module>:invoke_void__this___object_EventArgs (object,System.EventArgs) | |
at System.Web.HttpApplication.PipelineDone () [0x00000] in <filename unknown>:0 | |
--> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment