I’m trying to join a session from my Android (Kotlin) app using the following code:
websocket = factory.createSocket(getWebSocketAddress());
I am unsure what exactly I should pass to getWebSocketAddress()
. I attempted to use the token
I received from the openvidu/api/sessions/miserable-pink-wildcat/connection
endpoint, but it results in the following error:
{"id":0,"error":{"code":401,"message":"Unable to join session miserable-pink-wildcat. Token wss://{my-domain-host}:443/openvidu?sessionId=miserable-pink-wildcat&token=wss://{my-domain-host}?sessionId=miserable-pink-wildcat&token=tok_UGdTdQzxdvtas7LL is not valid. Code: 401"},"jsonrpc":"2.0"}
I also tried decoding the token from the token field in the openvidu/api/sessions/miserable-pink-wildcat/connection response, but I encountered the same error:
{"id":0,"error":{"code":401,"message":"Unable to join session miserable-pink-wildcat. Token wss://{my-domain-host}:443/openvidu?sessionId=miserable-pink-wildcat&token=tok_SvsyUrQzRtZA0UE7 is not valid. Code: 401"},"jsonrpc":"2.0"}
I attempted to remove the port, but it still gives me the same error:
{"id":0,"error":{"code":401,"message":"Unable to join session miserable-pink-wildcat. Token wss://{my-domain-host}/openvidu?sessionId=miserable-pink-wildcat&token=wss://{my-domain-host}?sessionId=miserable-pink-wildcat&token=tok_BwcHN8y612d3seL5 is not valid. Code: 401"},"jsonrpc":"2.0"}
Could anyone help me understand what might be going wrong and how I should handle the WebSocket token correctly?