                 when 'broker.clientDisconnected'
                   @cleanUpAfterDisconnect messageStr
 
-      connection.exchange 'auth', AUTH_EXCHANGE_OPTIONS, (authExchange)=>
+      connection.exchange 'auth', AUTH_EXCHANGE_OPTIONS, (authExchange) =>
         connection.queue  'auth', (authQueue)=>
           authQueue.bind authExchange, ''
           authQueue.on 'queueBindOk', =>
-            authQueue.subscribe (message, headers, deliveryInfo)=>
+            authQueue.subscribe (message, headers, deliveryInfo) =>
               {routingKey, correlationId} = deliveryInfo
               socketId = correlationId
               messageStr = "#{message.data}"


    return serviceInfo

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

            callbacks : {}
          }

    ensureGroupPermission = (group, account, roles, callback) ->
      {JPermissionSet, JGroup} = @bongo.models
      client = {context: group.slug, connection: delegate: account}
      JPermissionSet.checkPermission client, "read activity", group,
        (err, hasPermission) ->
          if err then callback err
          else unless hasPermission
            callback {message: 'Access denied!', code: 403}
          else
            JGroup.fetchSecretChannelName group.slug, callback

    joinClientGroupHelper = (messageData, routingKey, socketId) ->
      {JAccount, JGroup} = @bongo.models
      fail = (err) =>
        console.error err  if err
        @rejectClient routingKey
      @authenticate messageData, routingKey, (session) =>
        unless session then fail()
        else JAccount.one {'profile.nickname': session.username},
          (err, account) =>
            if err or not account then fail err
            else JGroup.one {slug: messageData.group}, (err, group) =>
              if err or not group then fail err
              else 
                group.fetchRolesByAccount account, (err, roles) =>
                  if err or not roles then fail err
                  else
                    ensureGroupPermission.call this, group, account, roles,
                      (err, secretChannelName) =>
                        if err or not secretChannelName
                          @rejectClient routingKey
                        else
