-
-
Save astrotars/e0df0a7fc1850269169e61feb95849d1 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
async function initializeClient(username) { | |
const token = await generateToken(username); | |
// Set the current logged user | |
client.setUser( | |
{ | |
id: username, | |
name: 'Jon Snow', // Update this name dynamically | |
image: 'https://bit.ly/2u9Vc0r' | |
}, | |
token | |
); // token generated from our PHP server | |
// create or initialize the channel | |
channel = client.channel('messaging', 'general-channel1', { | |
name: 'General Room for platform', | |
image: 'https://bit.ly/2F3KEoM', | |
members: [], | |
session: 8 // custom field, you can add as many as you want | |
}); | |
// Watch the channel for events | |
await channel.watch(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment