Cannot use a local variable "connection" as it isn't available globally and making it global would be messy.  Also made suggestions as per comments on stackoverflow (http://stackoverflow.com/questions/16971420/requirejs-module-for-signalr/17352705?noredirect=1#comment25450174_17352705) and used $.connection.hub.stateChanged() to identify if the connection is ready.