Skip to content

Instantly share code, notes, and snippets.

@BrightnBubbly
Created April 20, 2020 00:23
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 BrightnBubbly/c20d6244b8bb583f23c08c2d2d39271d to your computer and use it in GitHub Desktop.
Save BrightnBubbly/c20d6244b8bb583f23c08c2d2d39271d to your computer and use it in GitHub Desktop.
const initializeClient = async () => {
const {data} = await axios.post("api/generate_token",{name:'admin'});
const client = new StreamChat(process.env.MIX_STREAM_API_KEY, { timeout: 6000 });
await client.setUser({id: 'admin', name: 'Eze Sunday'}, data.token);
setClient(client);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment