Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/paulgreg/semi-persistent-chat
A simple node semi-persistent chat without database (messages are in server’s memory and purged after few hours)
https://github.com/paulgreg/semi-persistent-chat
node pwa react socket-io
Last synced: about 2 months ago
JSON representation
A simple node semi-persistent chat without database (messages are in server’s memory and purged after few hours)
- Host: GitHub
- URL: https://github.com/paulgreg/semi-persistent-chat
- Owner: paulgreg
- License: mit
- Created: 2019-10-19T21:31:01.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-09-13T13:14:04.000Z (4 months ago)
- Last Synced: 2024-09-14T03:56:20.713Z (4 months ago)
- Topics: node, pwa, react, socket-io
- Language: JavaScript
- Homepage: https://semi-persistent-chat.fly.dev/
- Size: 3.45 MB
- Stars: 8
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Semi Persistent Chat
That project is a simple semi-persistent PWA chat using web socket.
Messages are kept in memory and purged after X hours on the server (configurable).URLs sent in chat will be transformed as links. For media (image, audio or video), a preview will be displayed.
Login scren:
![Screenshot of login screen](./semi-persistent-chat-login.png 'Login screen')
Chat Screen :
![Screenshot of a chat](./semi-persistent-chat.png 'Chat')
## Features
- multi-room chat
- show media preview (image, video, audio)
- display web page title
- works on mobile
- edit or delete sent messages
- comment with emojis
- messages are saved in `tmp-data/semi-persistent-chat-dump.json` when server is halted and restored on next startup (to keep messages duging system update)## Configuration
Launch `npm run config` to create `src/config.mjs` (from `src/config.mjs.dist`) and update it according your needs.
## To dev
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
run `npm run dev:client` to launch client code (with watch) and `npm run dev:server` to launch server code
Webapp is served on port 3000 by devtools while node is launched on port 6060 (explaining while websocket and api calls are made on that port on non production env).
## To deploy on production using only node
Run `npm run build` to generate static files into `build` directory, then run `npm run start` which will serve static files.
## To deploy on production using nginx to serve static file (recommanded)
Run `./build.sh` to generate static files into `build` directory (change `PUBLIC_URL` in that file if needed).
Serve static files via a web server like nginx.
I’m using a symbolic link from `/var/www/semi-persistent-chat` to the `build` directory.Launch src/server file (I suggest you to use pm2 to launch server via `./pm2.sh`).
Finally, adapt nginx to let pass web socket and `/api` to node :
```
location /persistent-chat-ws/ {
proxy_pass http://127.0.0.1:6060;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
location /persistent-chat/api/ {
proxy_pass http://127.0.0.1:6060/api/;
proxy_http_version 1.1;
}
```## License
MIT