$ npm install -g [email protected]
$ npm install -g nodemon
$ npm install -g db-migrate
$ npm install -g db-migrate-pg
Before starting, install docker-compose to your machine and start docker containers:
$ docker-compose up
- need create .env file
- example: .env.sample
# Create tables
$ npm run up
# Delete tables
$ npm run down
$ npm install
$ npm run start:dev
- 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
- Event send message:
- Headers:
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
}