Whenever a person connects to Opentok, they need two things: session id and token
You can think of session ids as room ids. People who connect to the same session ids are able to talk to everyone else in the same session.
Tokens are just passwords to get into the session.
In your app, this may be the best flow:
- Two people using your app want to communicate with each other.
- Your app signals your server that they want to talk to each other.
- Your server will ask our server for a session id.
- Your server will generate a valid token that works for the session
id.
- Your server will relay the session id and token to your two people.
- Both users will connect to the session using the session id and
token, and then they will be able to talk to each other
If you can individually tackle each of those steps, it shouldn't be too hard.
It is up to your app implementation on how you will communicate that two users will want to start a session with each other. After that, you can follow the OpenTok documentations on how to do the rest of the steps (3-4 and 6)
References:
Please note that generating a session and a token should be done server-side, so the client does not see your api secret.