You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

stream-chat

Package Overview
Dependencies
Maintainers
5
Versions
283
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stream-chat

JS SDK for the Stream Chat API


Version published
Weekly downloads
164K
decreased by-3.84%
Maintainers
5
Install size
2.79 MB
Created
Weekly downloads
 

Package description

What is stream-chat?

The stream-chat npm package is a powerful tool for building chat applications. It provides a comprehensive set of features for real-time messaging, user management, and chat room creation, among others. It is designed to be highly customizable and scalable, making it suitable for a wide range of applications from simple chat widgets to complex messaging platforms.

What are stream-chat's main functionalities?

Real-time Messaging

This feature allows you to send real-time messages in a chat channel. The code sample demonstrates how to initialize the StreamChat client, create a channel, and send a message.

const StreamChat = require('stream-chat').StreamChat;
const client = new StreamChat('api_key');

async function sendMessage() {
  const channel = client.channel('messaging', 'general', {
    name: 'General Chat',
  });
  await channel.create();
  await channel.sendMessage({
    text: 'Hello, world!',
    user_id: 'user123',
  });
}
sendMessage();

User Management

This feature allows you to manage users within the chat application. The code sample demonstrates how to create or update a user with specific attributes.

const StreamChat = require('stream-chat').StreamChat;
const client = new StreamChat('api_key');

async function createUser() {
  await client.upsertUser({
    id: 'user123',
    name: 'John Doe',
    role: 'user',
  });
}
createUser();

Channel Management

This feature allows you to manage chat channels. The code sample demonstrates how to create a new chat channel with a specific name and type.

const StreamChat = require('stream-chat').StreamChat;
const client = new StreamChat('api_key');

async function createChannel() {
  const channel = client.channel('messaging', 'general', {
    name: 'General Chat',
  });
  await channel.create();
}
createChannel();

Message Reactions

This feature allows users to add reactions to messages. The code sample demonstrates how to send a message and then add a 'like' reaction to that message.

const StreamChat = require('stream-chat').StreamChat;
const client = new StreamChat('api_key');

async function addReaction() {
  const channel = client.channel('messaging', 'general');
  await channel.create();
  const message = await channel.sendMessage({
    text: 'Hello, world!',
    user_id: 'user123',
  });
  await channel.sendReaction(message.id, {
    type: 'like',
    user_id: 'user123',
  });
}
addReaction();

Other packages similar to stream-chat

Readme

Source

Stream Chat JS

Build Status

NPM

stream-chat-js is the official JavaScript client for Stream Chat, a service for building chat applications.

You can sign up for a Stream account at https://getstream.io/chat/get_started/.

Installation

Install with NPM
npm install stream-chat
Install with Yarn
yarn add stream-chat
Using JS deliver
<script src="https://cdn.jsdelivr.net/npm/stream-chat"></script>

API Documentation

Documentation for this JavaScript client are available at the Stream website

Keywords

FAQs

Package last updated on 10 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc