How to join in the room with different role?
A room is created for the teacher with the name 123456. At the same time, invitation codes are created for the student and the observers, which the teacher will send to them latter. For example, the original name of the room is 123456, 123456O observer code, 123456S student code. I need to get this last letter to identify the role of the connected user. How can I make it?
8 Replies
Hi @MaxEsin. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
I apologize, but the knowledge sources provided do not contain specific information about joining rooms with different roles or using invitation codes in the way you've described for NormalVR. The documentation available doesn't mention a built-in role system or invitation code mechanism as you've outlined.
However, I can provide some general guidance based on the available information about connecting to rooms in NormalVR:
1. NormalVR uses a simple room connection system where clients connect to rooms using a room name. As per the Realtime Class Reference, you can connect to a room using the
Connect
method:
2. While there's no built-in role system, you could potentially implement your own by using the webhookContext
parameter when connecting to a room. This is mentioned in the Webhooks documentation:
"In order to authenticate individual users, Normcore supports passing an optional context string when connecting to a room. In Unity, Connect()
on Realtime
and Room
support a webhookContext
parameter that will be passed along to your webhook."
You could use this to pass role information when connecting, which your server could then validate.
3. To implement the specific system you're describing, you would need to create your own logic on top of NormalVR's basic room connection system. This might involve:
- Creating a custom room naming convention
- Implementing your own invitation code system
- Using the webhookContext
to pass role information
- Implementing server-side logic to validate these custom parameters
However, the exact implementation details would depend on your specific requirements and server setup, which are beyond the scope of the provided NormalVR documentation.
If you need more specific guidance on implementing such a system with NormalVR, I recommend reaching out to NormalVR's support team or consulting their more detailed documentation if available.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@328247194794852352> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
@Normcore Assistant where should I implement the server-side logic for the validation and which property contain webhookContext string?
Let me check the knowledge base for you again. One moment! :books:
----------------------
To implement server-side logic for validation using the webhookContext in NormalVR, you'll need to use Normcore Private and set up a webhook. Here's the relevant information based on the provided knowledge sources:
1. Server-side logic implementation:
The server-side logic for validation should be implemented in your webhook endpoint. As described in the Webhooks documentation, you need to set up a webhook URL that Normcore will call to verify whether an application or user is entitled to access Normcore.
2. Webhook configuration:
- For Normcore Private Cloud: The webhook URL is configured when your Normcore Private Cloud installation is created by Normal. You'll need to contact Normal's support to set this up or change it.
- For Normcore Private On-Premises: You can specify the webhook URL using the
webhook-url
property in the matcher-config.yaml
file.
3. Webhook request format:
The webhookContext string is passed in the "context" field of the webhook request. Here's an example of how it appears in the request body:
You can see that the "context" field contains the webhookContext string you pass when connecting to a room.
4. Implementing the validation:
In your webhook endpoint, you should parse the incoming request, extract the "context" field, and implement your custom logic to validate the role or any other information you've passed in the webhookContext.
5. Responding to the webhook:
After validating, your webhook should respond with a status for each request. For example:
Or, if you want to deny access:
Remember, this feature is only available with Normcore Private. If you're using the public Normcore service, you won't have access to this webhook functionality for custom validation.
For more detailed information on setting up and using webhooks, please refer to the Webhooks documentation.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@328247194794852352> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
it would be easier just to set client id 0 as the teacher and every other client who joins later as students
@Mechabit Thanks for the reply🙂 But the roles of the student and the observer are different. The student will go through the learning process and the observers will monitor, watch and listen to what the teacher says.
if you need to sync the role type you can make a custom model with an enum
use the first half of the join code as the room name