Skip to content

Instantly share code, notes, and snippets.

@isaidspaghetti
Last active August 20, 2020 21:04
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 isaidspaghetti/828c1aabb6e6365480e98b8d70721bc2 to your computer and use it in GitHub Desktop.
Save isaidspaghetti/828c1aabb6e6365480e98b8d70721bc2 to your computer and use it in GitHub Desktop.
try {
//...first half of function
const { customerId, customerToken, channelId, streamApiKey } = await response.json();
chatClient = new StreamChat(streamApiKey);
await chatClient.setUser(
{
id: customerId,
name: firstName,
},
customerToken,
);
const channel = chatClient.channel('messaging', channelId, {
name: `Chat with ${customerId}`
});
await channel.watch;
setChannel(channel);
} catch (e) {
console.error(e, e.error);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment