Indexed $this->sockets and $this->user

Added an index on $this->user->id for both $this->sockets and $this->user, which improves the processing time and simplifies the code.