 			io.sails.path = "#{env.path}/socket.io"
 			io.sails.useCORSRouteToGetCookie = false
 			socket = null
-			p = new Promise (fulfill, reject) ->
+			backend = new Promise (fulfill, reject) ->
 				socket = io.sails.connect()
 				socket.on 'connect', ->
 					resource = $injector.get('resource')

					reject()
				socket.on 'connect_timeout', ->
					reject()
					
			(method, url, post, callback, headers, timeout, withCredentials, responseType) ->
				p
					.then ->
						io.socket = socket
						opts = 

					else
						location.hash = data.additionalData.data.url
				
				push.on 'error', alert