Unexpected behavior of JSON-RPC call joinRoom from Unity client


we use OpenVidu Enterprise 2.29.0 and we plan to create a Unity App from which we want users to be able to participate in WebRTC sessions.
Since there is no official Unity package or C# library for OpenVidu, we want to create our own implementation by using the OV REST-API and JSON-RPC message protocol.

We now ran into a weird problem and don’t really understand what’s going on. The problem occurs after we try to make the joinRoom call. The OV server is creating a new connection object with role SUBSCRIBER, instead of using the one we created via the API and role PUBLISHER. We don’t have an application server yet. Our Unity client is communicating directly with the OV server.

These are all the steps we are doing:

  • try to fetch Session with name X (GET https://{OUR_SERVER_URL}/openvidu/api/sessions/X)
  • (if 404 status is returned) create a new Session with customSessionId being X (POST https://{OUR_SERVER_URL}/openvidu/api/sessions)
  • create a new Connection (with role PUBLISHER) and get a Token (POST to https://{OUR_SERVER_URL}/openvidu/api/sessions/X/connection)
  • connect to the server via WebSocket connection (to https://{OUR_SERVER_URL}/openvidu)
  • send a JSON-RPC message with the following properties via the opened WebSocket connection:
    "id": 1,
    "jsonrpc": "2.0",
    "method": "joinRoom",
    "params": {
        "metadata": "{\"some\": \"data\"}",
        "platform": "Unity {UNITY_VERSION} on {PLATFORMNAME}",
        "recorder": false,
        "sdkVersion": "2.29.0",
        "secret": "{OUR_SECRET}",
        "session": "TestSession",
        "token": "{TOKEN}"

{TOKEN} will of course be the Token we received via the create connection API request.

We don’t actually receive any errors from the OV server but when we look up our Connection properties via OV Inspector we see that all the properties supplied in the joinRoom call have been applied to a new SUBSCRIBER connection. Via the API we can see that the PUBLISHER connection we created earlier is still stored in the session but without any of the properties we supplied in the joinRoom call. So there are now two connections. One created via the connection create API request and one created via the joinRoom call.

From your documentation we don’t think this is intended behaviour. Any ideas what causes this problem?


I think the problem could be the presence pf the “secret” attribute inside the “params” object. Remove its value (leaving a blank string) and it should work ok.

1 Like

That solved our issue.
Thanks a lot!