     @counts[serviceType] += 1
     return serviceInfo
 
-  addService:({serviceGenericName, serviceUniqueName, loadBalancing})->
+  addService: ({serviceGenericName, serviceUniqueName, loadBalancing}) ->
     servicesOfType = @services[serviceGenericName] ?= []
     servicesOfType.push {serviceUniqueName, loadBalancing}
 
-  removeService:({serviceGenericName, serviceUniqueName})->
+  removeService: ({serviceGenericName, serviceUniqueName}) ->
     servicesOfType = @services[serviceGenericName] 
     index = (i for s, i in servicesOfType \
                when s.serviceUniqueName is serviceUniqueName)[0]


    return serviceInfo

  monitorPresence:(connection)->
    Presence = require 'koding-rabbit-presence'
    @presence = new Presence {
      connection


  bound: require 'koding-bound'

  authenticate: (messageData, routingKey, callback) ->
    {clientId, channel, event} = messageData
    @requireSession clientId, routingKey, callback

  requireSession: (clientId, routingKey, callback) ->
    {JSession} = @bongo.models
    JSession.fetchSession clientId, (err, session) =>
      if err? or not session? then @rejectClient routingKey
      else
        tokenHasChanged = session.clientId isnt clientId
        @updateSessionToken session.clientId, routingKey  if tokenHasChanged
        callback session

  updateSessionToken: (clientId, routingKey) ->
    @bongo.respondToClient routingKey,
      method      : 'updateSessionToken'
      arguments   : [clientId]
      callbacks   : {}

  getNextServiceInfo: (serviceType) ->
    count = @counts[serviceType] ?= 0
    servicesOfType = @services[serviceType]
    return  unless servicesOfType?.length
