def onConnect(self, req):
        """ Method is called by the Autobahn engine when a request to establish
            a connection has been received.

            @param req:     Connection Request object.
            @type  req:     autobahn.websocket.ConnectionRequest

            @return:        Deferred which fires callback with None or errback
                            with autobahn.websocket.HttpException
        """
        params = req.params

        try:
            userID = params['userID']
            robotID = params['robotID']
            password = params['password']
        except __HOLE__ as e:
            raise HttpException(httpstatus.HTTP_STATUS_CODE_BAD_REQUEST[0],
                                'Request is missing parameter: {0}'.format(e))

        for name, param in [('userID', userID), ('robotID', robotID),
                            ('password', password)]:
            if len(param) != 1:
                raise HttpException(httpstatus.HTTP_STATUS_CODE_BAD_REQUEST[0],
                                    "Parameter '{0}' has to be unique in "
                                    'request.'.format(name))

        d = self._realm.login(userID[0], robotID[0], password[0])
        d.addCallback(self._authenticate_success)
        d.addErrback(self._authenticate_failed)
        return d
dataset/ETHPy150Open rapyuta/rce/rce-comm/rce/comm/server.py/RobotWebSocketProtocol.onConnect