/data/send room not found

Petro O. Bochan

New Member
Hello, when using a built-in roomApp (http://localhost:8081/apps/RoomApp) sending messages using the provided FPWCSApi2RoomManager class works just fine (onMessageCallback is invoked on the appropriate client/participant). However, when making a rest call using the following


{
"nodeId":"UCybjxNUIiJdSgV8YgaTZanb5gD7zk3V@255.255.255.255",
"operationId":"0D2FED0B-18EC-4321-A22F-E6743C918F44",
"sessionId":"/176.120.53.198:60309/10.0.0.6:8443-a5d730f6-b64f-4598-8a0f-172170f08c43",
"payload":{
"message":"hello"
}
}

I'm getting this weird response in console "Can not find room with name id (null)", "onMessageCallback" is not invoked either. This leads me to thinking that in "payload" I need to specify room name. How do I go about it?
 

Max

Administrator
Staff member
Good day.
Try to send payload as follows:
Code:
          "roomConfig": {
            "name": "room1"
          },
          "to": "clientName",
          "text": "hello"
 

Max

Administrator
Staff member
Look like you're trying to mix RoomApi with custom backend. This will not work properly. Please try to use pure FPWCSApi2Session::sendData() on client side to send data to server and /OnDataEvent REST hook with /data/send REST API on backend side to send data to clients. In this case, you can use any custom payload ddata
 

Petro O. Bochan

New Member
That's the point - we are not using any custom backend, but native "roomApp". This should work since if I use iOS/Android/Web code, messages do get through. The only piece that's not working is through POST request.
 

Max

Administrator
Staff member
RoomApi is intended to message exchange between clients (text chat), without injections from server with REST API. Please also note that embedded WCS backend server may lack of perfomance if many participants will connect to one room simultaneously (for example, 700 subscribers per one podcast).
If you prefer to use RoomApi, and need REST API to send messages to clients, you should form the message payload to send to a certain client as
Code:
"payload": {
  "info": {
    "roomConfig": {
      "name": "room1"
    },
    "from": "test1",
    "to": "test2",
    "text": "hello"
  },
  "name": "MESSAGE"
  "roomName": "room1"
}
 
Top