Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
console.error('STREAM_API_KEY should be set');
return;
}
if (!appId) {
console.error('STREAM_APP_ID should be set');
return;
}
if (!apiSecret) {
console.error('STREAM_SECRET should be set');
return;
}
console.log(apiKey, apiSecret);
let client: CloudClient = stream.connectCloud(apiKey, appId, {
// urlOverride: {
// api: apiUrl,
// },
keepAlive: false,
});
function createUserSession(userId): UserSession {
return client.createUserSession(
stream.signing.JWTUserSessionToken(apiSecret, userId),
);
}
let batman = createUserSession('batman');
let content = 'test2';
console.log(await batman.feed('notification').get({ limit: 1 }));
await batman.feed('notification').addActivity({
if (!apiKey) {
console.error('STREAM_API_KEY should be set');
return;
}
if (!appId) {
console.error('STREAM_APP_ID should be set');
return;
}
if (!apiSecret) {
console.error('STREAM_SECRET should be set');
return;
}
let client: CloudClient = stream.connectCloud(apiKey, appId);
function createUserSession(userId): UserSession {
return client.createUserSession(
stream.signing.JWTUserSessionToken(apiSecret, userId),
);
}
let batman = createUserSession('batman');
let fluff = createUserSession('fluff');
let league = createUserSession('justiceleague');
let bowie = createUserSession('davidbowie');
console.log('Add the following line to your .env file');
console.log('STREAM_API_TOKEN=' + batman.token);
await batman.user.getOrCreate({