A simple application to send notification using socket.io and node.js
I always think about how things are behind it, so based on the firebase message service, I decided to create my own, first which technology to use?
- Socket is my first choice
- Node.js, simple and powerfull solution
So I started creating it, and this is the result
- You can use docker, to start the application inside a container, just run:
docker-compose up --build -d
in main path.
To start in dev environment, you need use: node >= 16, yarn >= 1.22, this app using nodemon to hot update feature.
- Configure your .env file:
APP_TOKEN
is your password, it is necessary to authenticate the application when you send the notification, or recive. AndDATABASE_URL
, for default is it is consistent with docker-compose
After config you need run migrations from prisma, run: yarn db:update
, after run yarn start:dev
and be happy codding 🤯.
To test socket I'm use firecamp, connected to port 3025, and listen notification
:
To auth, in Connections tab, send your token set in .env:
When you send post in path api/notification
, the app emit the notification to all socket connections avaible.
- To see in a more friendly version use the dashboard, in this repository