How to use stream-chat - 2 common examples

To help you get started, we’ve selected a few stream-chat examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GetStream / layer-migration / serverless / handler.js View on Github external
function getStreamClient() {
	if (!process.env.STREAM_API_KEY) {
		throw Error('Environment variable STREAM_API_KEY is not defined!');
	}

	if (!process.env.STREAM_API_SECRET) {
		throw Error('Environment variable STREAM_API_SECRET is not defined!');
	}

	const client = new StreamChat(
		process.env.STREAM_API_KEY,
		process.env.STREAM_API_SECRET
	);

	return client;
}
github GetStream / stream-cli / src / utils / auth / chat-auth.js View on Github external
async function chatAuth(ctx) {
	try {
		const { apiKey, apiSecret, apiBaseUrl } = await credentials(ctx);

		const chatClient = new StreamChat(apiKey, apiSecret);
		chatClient.setBaseURL(apiBaseUrl);

		return chatClient;
	} catch (error) {
		ctx.error(
			`Authentication required. Use the command ${chalk.green.bold(
				'stream config:set'
			)} to authenticate.`,
			{
				exit: 1,
			}
		);
	}
}

stream-chat

JS SDK for the Stream Chat API

SEE LICENSE IN LICENSE
Latest version published 11 days ago

Package Health Score

89 / 100
Full package analysis

Popular stream-chat functions