     unless fromUser
       error = @errorBuilder.makeError 'noUserOnline', @username
       return sendResult socket, idcmd, cb, error
+    processMessage msg
     toUser.message @username, msg, (error) =>
       if error
         return sendResult socket, idcmd, cb, error
-      processMessage msg
       fromUser.userState.socketsGetAll (error, sockets) =>
         if error
           wrappedError = makeServerError @errorBuilder, error
           return sendResult socket, idcmd, cb, wrappedError
-        for own id, fromSocket of sockets
+        for id in sockets
           if id != socket.id
-            fromSocket.emit 'directMessageEcho', toUserName, msg
+            @send id, 'directMessageEcho', toUserName, msg
         toUser.userState.socketsGetAll (error, sockets) =>
           if error
             wrappedError = makeServerError @errorBuilder, error
             return sendResult socket, idcmd, cb, wrappedError
-          for own id, toSocket of sockets
-            toSocket.emit 'directMessage', @username, msg
+          for id in sockets
+            @send id, 'directMessage', @username, msg
           sendResult socket, idcmd, cb
 
   directRemoveFromList : (socket, idcmd, cb

        user.userState.socketsGetAll (error, sockets) =>
          if error
            return fn makeServerError @errorBuilder, error
          for own id, toSocket of sockets
            toSocket.emit 'roomAccessRemoved', roomName
          fn()
    , cb

  broadcast : (socket, roomName, args...) ->
    socket.broadcast.to(roomName).emit args...

  ###
  # commands

          wrappedError = makeServerError @errorBuilder, error
          return sendResult socket, idcmd, cb, wrappedError
        if @enableUserlistUpdates
          @send roomName, 'roomUserJoin', roomName, @username
        makeClosure = (id) =>
          return (error) =>
            # TODO other sockets errors handling
            if socket.id == id
              sendResult socket, idcmd, cb, error
            @send id, 'roomJoined', roomName
        # TODO lock user state
        @userState.socketsGetAll (error, sockets) =>
          if error
            wrappedError = makeServerError @errorBuilder, error
            return sendResult socket, idcmd, cb, wrappedError
          for id in sockets
            @server.nsp.adapter.add id, roomName, makeClosure id

  roomLeave : (socket, idcmd, cb
  , roomName) ->
