Skip to content

Instantly share code, notes, and snippets.

@dongido001
Created July 8, 2019 16:29
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 dongido001/9c5a9d0e4a8f3f61a427bb3510528425 to your computer and use it in GitHub Desktop.
Save dongido001/9c5a9d0e4a8f3f61a427bb3510528425 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