# How to change SUBSCRIBER into PUBLISHER during a session?

**URL:** <https://openvidu.discourse.group/t/how-to-change-subscriber-into-publisher-during-a-session/3889>\
**Category:** Issues developing apps\
**Tags:** v2\
**Created:** [April 15, 2022, 2:20am UTC](https://openvidu.discourse.group/t/how-to-change-subscriber-into-publisher-during-a-session/3889 "2022-04-15T02:20:12Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wann\_Lee](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/wann_lee/32/1889_2.png) [@Wann\_Lee](https://openvidu.discourse.group/u/Wann_Lee)\
**Post date:** [April 15, 2022, 2:20am UTC](https://openvidu.discourse.group/t/how-to-change-subscriber-into-publisher-during-a-session/3889/1 "2022-04-15T02:20:12Z")

</div>

A certain user is broadcasting in one session.  
At first, only one person is publishing in the corresponding Session.  
Then, what kind of procedure should one of the viewers, who is a SUBSCRIBER, change their role to PUBLISHER and send the video?

I use React, ReactNative

---

<div class="post-metadata">

**Author:** ![Wann\_Lee](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/wann_lee/32/1889_2.png) [@Wann\_Lee](https://openvidu.discourse.group/u/Wann_Lee)\
**Post date:** [April 18, 2022, 8:39am UTC](https://openvidu.discourse.group/t/how-to-change-subscriber-into-publisher-during-a-session/3889/2 "2022-04-18T08:39:12Z")

</div>

Is there no way?  
I hope somebody could answer me.

---

<div class="post-metadata">

**Author:** ![CSantosM](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/csantosm/32/16_2.png) [@CSantosM](https://openvidu.discourse.group/u/CSantosM)\
**Post date:** [April 18, 2022, 8:56am UTC](https://openvidu.discourse.group/t/how-to-change-subscriber-into-publisher-during-a-session/3889/3 "2022-04-18T08:56:37Z")

</div>

You can’t change the participant role on the fly. For doing this you should reconnect the participant with the right role or create it with the right role (publisher) and avoid publish its media (as a fake subscriber).

---

<div class="post-metadata">

**Author:** ![pabloFuente](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/pablofuente/32/2536_2.png) [@pabloFuente](https://openvidu.discourse.group/u/pabloFuente)\
**Post date:** [April 18, 2022, 10:04am UTC](https://openvidu.discourse.group/t/how-to-change-subscriber-into-publisher-during-a-session/3889/4 "2022-04-18T10:04:02Z")

</div>

Further expanding on my colleague’s response, in fact you can change roles, if you are using OpenVidu Pro or OpenVidu Enterprise:

- [REST API - OpenVidu Docs](https://docs.openvidu.io/en/2.21.0/reference-docs/REST-API/#patch-connection)
- [openvidu-java-client API - OpenVidu Docs](https://docs.openvidu.io/en/2.21.0/reference-docs/openvidu-java-client/#update-a-connection)
- [openvidu-node-client API - OpenVidu Docs](https://docs.openvidu.io/en/2.21.0/reference-docs/openvidu-node-client/#update-a-connection)

---

<div class="post-metadata">

**Author:** ![Wann\_Lee](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/wann_lee/32/1889_2.png) [@Wann\_Lee](https://openvidu.discourse.group/u/Wann_Lee)\
**Post date:** [April 21, 2022, 10:48am UTC](https://openvidu.discourse.group/t/how-to-change-subscriber-into-publisher-during-a-session/3889/6 "2022-04-21T10:48:50Z")

</div>

I appreciate your answer.

I am trying to change user’s role.

A broadcast is streaming in live.  
A user joined as a subscriber and he changed his role under permission of the broadcaster.

let connectionProperties = {  
type: “WEBRTC”,  
role: “PUBLISHER”,  
record: true  
};  
let connectionId = connection.connectionId;  
session.updateConnection(connectionId, connectionProperties).then(connection =\> {  
console.log('session.updateConnection \> ', connection);  
});

But,  
session.updateConnection is not a function error always happens.

At present I am testing OpenVidu Pro, but later I will change it into Enterprise.

Am I missing something?

---

<div class="post-metadata">

**Author:** ![Wann\_Lee](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/wann_lee/32/1889_2.png) [@Wann\_Lee](https://openvidu.discourse.group/u/Wann_Lee)\
**Post date:** [April 21, 2022, 11:04am UTC](https://openvidu.discourse.group/t/how-to-change-subscriber-into-publisher-during-a-session/3889/7 "2022-04-21T11:04:21Z")

</div>

At present I used “session.updateConnection()” in javascript file of Frontend.  
Do I have to use “session.updateConnection()” in Node of Backend?

---

<div class="post-metadata">

**Author:** ![pabloFuente](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/pablofuente/32/2536_2.png) [@pabloFuente](https://openvidu.discourse.group/u/pabloFuente)\
**Post date:** [April 21, 2022, 11:11am UTC](https://openvidu.discourse.group/t/how-to-change-subscriber-into-publisher-during-a-session/3889/8 "2022-04-21T11:11:28Z")

</div>

Yes. Roles must be of course changed from your backend. It wouldn’t make sense for a client to change its own role, would it?

---

<div class="post-metadata">

**Author:** ![Wann\_Lee](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/wann_lee/32/1889_2.png) [@Wann\_Lee](https://openvidu.discourse.group/u/Wann_Lee)\
**Post date:** [April 22, 2022, 12:45am UTC](https://openvidu.discourse.group/t/how-to-change-subscriber-into-publisher-during-a-session/3889/9 "2022-04-22T00:45:34Z")

</div>

Thanks for kind guiding. I will try it again.

Is openvidu-browser API for Frontend and openvidu-node-client API is for Backend?
