REST hooking connectionStatusEvent or streamStatusEvent in RoomAPI

sangsoo

Member
Hello.
I try to hook only connectionStatusEvent (or streamStatusEvent) for the purpose of exception handling such as chrome tam termination during publishing.

-----Version info-----
wcs_version=5.2.1453-c00a60c817d01c644f542b044b48adce9314f727
wcs_client_version=2.0.224-9175fa9b6c3a5b6960bea3831f1258bcf7eba4af

1. Use the Room API.
2. Updated wcs roomApp url by adding my backend URL to hook.
1666674714341.png

3. Execute Join with the conference sample.
4. It proceeds from OnDataEvent to RECV. (When using the default localhost/echo/RoomApp, publish continued.)
1666674584651.png

5. In the client (Chrome), it is not in the SESSION_STATUS.SEND_DATA_STATUS ACCEPTED state and is still waiting.

What is the problem? Please let me know if there is something I am using wrong.
thank.
 
Last edited:

Max

Administrator
Staff member
Good day.
The latest public WCS build is 5.2.1452, not 1453.
Please check if Conference example works with a default application http://localhost:8081/apps/RoomApp. If yes, you did not probably pass any REST hooks from your custom application to default RoomApp. This must be done because a RoomApi logic is implemented inside the server code.
So your custom REST hook application should proxy any REST query to the default RoomApp and then return its response to the client. Please see example in this post.
 

sangsoo

Member
Thanks for the reply.

I have additional questions. OnDataEvent Hooking response data.
1666750815534.png

1. Fail if there is no "OK" phrase after 200? (I am testing it.)
- Client failed to get status (SESSION_STATUS.SEND_DATA_STATUS ACCEPTED)
2. Is it okay to use keep-alive instead of Connection: close?
3. Other
- zapp-??? in wcs release notes What does prefix mean?
- For wcs version information, I checked here.
1666752115917.png


I'll wait for your reply. thank you
 
Last edited:

Max

Administrator
Staff member
1. Fail if there is no "OK" phrase after 200? (I am testing it.)
Yes, it should be HTTP/1.1 200 OK, both status code and response phrase are required
2. Is it okay to use keep-alive instead of Connection: close?
May be. Note that connection may also be closed by library which is used by WCS (of course, we do not implement HTTP directly, but using Apache library to do the work).
3. Other
- zapp-??? in wcs release notes What does prefix mean?
This is our new project which requires also some changes in server code. The project iself is on pre-alpha stage yet.
- For wcs version information, I checked here.
We have a high commit rate in last time, so build number is changing often.
 

sangsoo

Member
Thank you Max.
I haven't solved it yet.
Our backend service is using Spring Boot, so it is difficult to pass a reason phrase. (Pass an empty string instead - "HTTP/1.1 200 ")

In Tomcat 8.x, it was supported with sendReasonPhrase, but in Tomcat 9 it was removed.
- https://tomcat.apache.org/tomcat-8.5-doc/config/http.html
- https://stackoverflow.com/questions/49610522/spring-boot-return-http-1-1-200-not-http-1-1-200-ok

Can you support the use of empty string in reason phrase?
I'll wait for your reply. thank you
 

Max

Administrator
Staff member
Unfortunately we can't reproduce the issue on PHP backend. Please reproduce it and collect a report including server logs using report.sh script and traffic dump at server side, then send using this form.
 

Max

Administrator
Staff member
You can also try to set up a reverse HTTP proxy (nginx for example) at front of backend server to fix its responses.
 

sangsoo

Member
Hello Max, I have collected and sent the logs.
I'll also refer to the reverse HTTP proxy set.
Have a good weekend. Thanks.
 

Max

Administrator
Staff member
We checked the report.
According to the traffic dump and logs, WCS correctly parses your custom backend responses. But we see no requests forwarded by custom backend to the internal WCS RoomApp application http://wcs:8081/apps/RoomApp. This must be done because RoomApi logic is implemented in WCS core code. The RoomApp responses also must be forwarded by custom backend. So, your Spring Boot application must work as proxy.
Please see PHP example in this post.
 

sangsoo

Member
I missed the request to the internal WCS RoomApp .
After receiving the resthook, I understood it to only do the return response for echo.
I'll try again by adding a request.
Thanks.
 
Top