Skip to content

Instantly share code, notes, and snippets.

@BrightnBubbly
Created April 9, 2020 12:09
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/3646290a864dc81d9aacc23014cf2093 to your computer and use it in GitHub Desktop.
Save BrightnBubbly/3646290a864dc81d9aacc23014cf2093 to your computer and use it in GitHub Desktop.
// [...]
async initializeClient () {
// Initialize the StreamChat SDK
const {data} = await axios.post('/api/generate-token', {
username: this.autheduser.email.replace(/[@\.]/g, '_')
})
const client = new StreamChat(process.env.MIX_STREAM_API_KEY, {timeout: 9000});
await client.setUser(
{
id: this.autheduser.email.replace(/[@\.]/g, '_'),
name: this.autheduser.name,
},
data.token,
);
this.client = client
},
// [...]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment