Skip to content

Instantly share code, notes, and snippets.

@DanyF-github
Created January 8, 2021 10:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DanyF-github/4e2571d9fe97fcda789f9447b92e0bf0 to your computer and use it in GitHub Desktop.
Save DanyF-github/4e2571d9fe97fcda789f9447b92e0bf0 to your computer and use it in GitHub Desktop.
// server/src/graphql/videoApi.js
...
const joinSession = async (_, { uuid }, __, ___) => {
// check if a uuid has been provided
if (!uuid) {
throw new Error(INTERNAL_ERROR);
}
// Retrieve the session from the database
const [videocall] = videocalls.filter(videocall => videocall.uuid === uuid);
// initialize the opentok client
initializeOpentok();
// generating the token
const token = generateToken(videocall.sessionId);
//
return {
uuid,
token,
session: videocall.sessionId,
apiKey
};
};
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment