How to implement forceDisconnectByUser on server?

Hi I’m building an video conference app and have countered a problem with kicking out a participant in the room by the owner of the room.

My questions are

  1. can I send forceDisconnectByUser request to openvidu server with openvidu-java-client library?
  2. What are the differences between forceDisconnectByUser and forceDisconnectByServer?

The architecture of my server is simply one media server (latest kms), one server running for openvidu-server (basically your 2.26.0 openvidu-server), and a server which is for validation of user sending request and etc.

I would like to send HTTP delete request to my service server and process some validations on the request and then send forceDisconnect request using OpenVidu.Connection.forceDisconnect(String connectionId) and I’ve noticed that forceDisconnect method ends the connection with EndReason.forceDisconnectByServer. Now I’d like to force disconnect a user with EndReason.forceDisconnectByUser. I’ve found ways to do so on client’s side, but I would prefer to keep all the actions on server. Is there a possible way to do so?

Thanks in advance

The only difference between reason property forceDisconnectByUser and forceDisconnectByServer is precisely the origin of the request:

  • forceDisconnectByUser: a client with role MODERATOR forcibly evicted a participant from the session.
  • forceDisconnectByServer: your application backend forcibly evicted a participant from the session.

The behavior is exactly the same in both cases. The only difference is who sent the request to evict the participant.

1 Like

Thank you for your response.

Sicne forceDisconnectByUser seems to be the one I would like to use, I would like still to know if it’s possibe to send forceDisconnectByUser from a java server with openvidu-java-client library without too much of customizations.

Thank you!

No, it is not possible. I still don’t understand why is this a problem. The reason property of the event is just a descriptive parameter. There is no further functionality or consequences brought by this property.

You don’t “useforceDisconnectByUser or forceDisconnectByServer. This properties just provide your app information about who evicted a user: your client-side or your server-side. That’s it.

I wasnt saying that it is a problem, it’s more on me and my coworker’s preference on the descriptive parameter. I’d like to use forceDisconnectByUser if possible, but since it’s not we might just use forceDisconnectByServer or we can change client to send it from there.

Thanks for your response.