Skip to content

Instantly share code, notes, and snippets.

@jetaggart
Created August 3, 2020 18:47
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 jetaggart/61a55a25ac84212d100a7e92d6e97a04 to your computer and use it in GitHub Desktop.
Save jetaggart/61a55a25ac84212d100a7e92d6e97a04 to your computer and use it in GitHub Desktop.
const startChat = async () => {
const response = await axios.post("http://localhost:8080/stream-chat-credentials", {
username, leadId
});
const token = response.data.token;
const channelId = response.data.channelId;
const chatClient = new StreamChat(response.data.apiKey);
await chatClient.setUser({ id: response.data.userId, name: response.data.userName }, token);
const channel = chatClient.channel("messaging", channelId);
setChatClient(chatClient);
setChannel(channel);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment