 				emitArguments = arguments
 				$rootScope.$apply -> callback.apply socket, emitArguments
 		
-		$rootScope.$on 'debugLog', (error) => @emit 'debugLog', error
+		$rootScope.$on 'debugLog', (error) -> service.emit 'debugLog', error
 		
-		return
+		service
 		
 ]
 


# Connection and disconnection.
		
		@connect = -> socket.socket.connect()
		
		@connected = -> socket.socket.connected

		@disconnect = -> socket.disconnect()
		
# Proxy for Socket::on, handles invocation of Scope::$apply.
		
		@on = (eventName, callback) ->
			
			debugListeners["on-#{eventName}"] ?= (->
				socket.on eventName, (data) ->

		
# Proxy for Socket::emit, handles invocation of Scope::$apply.

		service.emit = (eventName, data, callback) ->
			return initializedQueue.push arguments unless service.connected()
			
			if config.get 'debugging'
				console.debug "sent: #{eventName}, #{JSON.stringify data, null, '  '}"
