-
-
Save jetaggart/61a55a25ac84212d100a7e92d6e97a04 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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