 			if record.extraInformation.port is process.env.PORT or connections[record.extraInformation.port]?
 				return
 
-			console.log 'connecting in', "localhost:#{record.extraInformation.port}"
+			logger.connection.info 'connecting in', "localhost:#{record.extraInformation.port}"
 			connections[record.extraInformation.port] = DDP.connect("localhost:#{record.extraInformation.port}", {_dontPrintErrors: true})
-			connections[record.extraInformation.port].call 'broadcastAuth', record._id, InstanceStatus.id(), (err, ok) ->
-				connections[record.extraInformation.port].broadcastAuth = ok
-				console.log "broadcastAuth with localhost:#{record.extraInformation.port}", ok
+			authorizeConnection(connections[record.extraInformation.port], record);
+			connections[record.extraInformation.port].onReconnect = ->
+				authorizeConnection(connections[record.extraInformation.port], record);
 
 		removed: (record) ->
 			if connections[record.extraInformation.port]? and not InstanceStatus.getCollection().findOne({'extraInformation.port': record.extraInformation.port})?
-				console.log 'disconnecting from', "localhost:#{record.extraInformation.port}"
+				logger.connection.info 'disconnecting from', "localhost:#{record.extraInformation.port}"
 				connections[record.extraInformation.port].disconnect()
 				delete connections[record.extraInformation.port]
 

@connections = {}
@startStreamBroadcast = (streams) ->
	console.log 'startStreamBroadcast'

	# connections = {}


				if connection.status().connected is true
					connection.call 'stream', streamName, args, (error, response) ->
						if error?
							logger.error "Stream broadcast error", error

						switch response
							when 'self-not-authorized'
								logger.stream.error "Stream broadcast from:#{process.env.PORT} to:#{connection._stream.endpoint} with name #{streamName} to self is not authorized".red
								logger.stream.debug "    -> connection authorized".red, connection.broadcastAuth
								logger.stream.debug "    -> connection status".red, connection.status()
								logger.stream.debug "    -> arguments".red, args

							when 'not-authorized'
								logger.stream.error "Stream broadcast from:#{process.env.PORT} to:#{connection._stream.endpoint} with name #{streamName} not authorized".red
								logger.stream.debug "    -> connection authorized".red, connection.broadcastAuth
								logger.stream.debug "    -> connection status".red, connection.status()
								logger.stream.debug "    -> arguments".red, args

							when 'stream-not-exists'
								logger.stream.error "Stream broadcast from:#{process.env.PORT} to:#{connection._stream.endpoint} with name #{streamName} does not exists".red
								logger.stream.debug "    -> connection authorized".red, connection.broadcastAuth
								logger.stream.debug "    -> connection status".red, connection.status()
								logger.stream.debug "    -> arguments".red, args


	Meteor.methods
