Socket
Socket
Sign inDemoInstall

direct-connect-chat

Package Overview
Dependencies
177
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    direct-connect-chat

A chat application with real-time messaging and email notifications


Version published
Maintainers
1
Created

Readme

Source

direct-connect-chat

Direct Connect Chat Package is a Node.js library that allows users to engage in one-on-one chats. It includes functionality to send chat requests, accept requests, and chat once connected. Additionally, the application uses Nodemailer to notify the receiver of a chat request. A cron job is implemented to delete messages older than 7 days. The application also features message encryption and decryption, as well as a block feature, and filter out messages with inappropriate language.

Installation

You can install the package using npm:

npm i direct-connect-chat

Usage

Environment Variables Configuration

To run this library, create a .env file in your project and configure the following environment variables:

  • DATABASE_HOST: [Your database host]
  • DATABASE_PORT: [Your database port]
  • DATABASE_NAME: [Your database name]
  • DATABASE_USER: [Your database username]
  • DATABASE_PASSWORD: [Your database password]
  • CHAT_SECRET_KEY: [Your secret key]
  • CRON_TIME: 0 0 * * *
  • NOTIFICATION_CRON_TIME: 30 11,13,15 * * *
  • EMAIL_HOST: [Your email host]
  • EMAIL_PORT: [Your email port]
  • EMAIL_FROM: [Your email from]
  • EMAIL_USER: [Your email username]
  • EMAIL_PASS: [Your email password]
  • NAVIGATE_URL: [Your navigate URL]
  • PORT: 3000

API DOCS

Direct connect chat APIs

POST Send chat
  • URL: ${url}/api/send-chat
  • Request Headers: Content-Type: application/json
  • Body raw (json):
    {
        "sender_id": "321",
        "receiver_id": "123",
        "message": "Hello"
    }
    
POST Accept chat invitation
  • URL: ${url}/api/accept-invitation
  • Request Headers: Content-Type: application/json
  • Body raw (json):
    {
        "sender_id": "321",
        "receiver_id": "123"
    }
    
GET Get chats
  • URL: ${url}/api/get-chats?sender_id=321&receiver_id=123&is_accepted=false
POST Block user
  • URL: ${url}/api/block-user
  • Body raw (json):
    {
        "sender_id": "2",
        "receiver_id": "123"
    }
    
POST Generate Token
  • URL: ${url}/api/generate-token
  • Body raw (json):
    {
        "user_id": "10"
    }
    

Keywords

FAQs

Last updated on 28 Mar 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc