Giter Club home page Giter Club logo

chat_app's Introduction

Global node js packages

$ npm install -g [email protected]
$ npm install -g nodemon
$ npm install -g db-migrate
$ npm install -g db-migrate-pg

Important!

Before starting, install docker-compose to your machine and start docker containers:

$ docker-compose up

Environment

  • need create .env file
  • example: .env.sample

Migrate database

# Create tables
$ npm run up
# Delete tables
$ npm run down

Start project

$ npm install
$ npm run start:dev

Swagger documentation

Socket.io api

  • ws://host:port/chat
    • Headers:
      • authorization
    • Events. Listen on connect.
      • msg_receive
      • error
    • Sending messages
      • Event send message:
        • msg_send
      • Event send file:
        • msg_send:file

Examples socket.io api

Message send: type JSON

{
    "room": "2d52e031-7039-48bb-8052-056649670bd1",
    "interlocutorId": 2,
    "message": "Hi, I'm Robert Deniro"
}

Message receive: type JSON

{
    "id": 10,
    "room": "2d52e031-7039-48bb-8052-056649670bd1",
    "date": "2022-08-09T09:55:22.753Z",
    "message": "Hi, I'm Robert Deniro",
    "filePath": null,
    "from": 4,
    "to": 2
}

File send: type JSON

{
    "room": "2d52e031-7039-48bb-8052-056649670bd1",
    "interlocutorId": 2,
    "file": "text file",
    "extension": "txt"
}

File receive: type JSON

{
    "id": 9,
    "room": "2d52e031-7039-48bb-8052-056649670bd1",
    "date": "2022-08-09T08:15:59.816Z",
    "message": null,
    "filePath": "http://localhost:8050/files/a39d83eb-ad2d-4182-a270-5c576d29e340.txt",
    "from": 4,
    "to": 2
}

chat_app's People

Contributors

bekhx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.