def METHOD_NAME(self, service: WebPubSubServiceClient, user_id: str, groups: Optional[List[str]] = None):
    def on_message(websocket_app: WebSocketApp, message: str): 
        message = json.loads(message)
        if message["type"] == "message":
            self.recv_messages.append(message["data"])
        if message["type"] == "system" and message["event"] == "connected":
            self.connection_ids.append(message["connectionId"])
        LOG.debug(message)
    def on_open(websocket_app: WebSocketApp): 
        LOG.debug("connected")
    token = service.get_client_access_token(groups=groups, user_id=user_id)
    client = WebSocketApp(token["url"], subprotocols=['json.webpubsub.azure.v1'], on_open=on_open, on_message=on_message)    
    self.clients.append(client)