This is a Socket.io server that sends alerts for Israel's national צבע אדום (red alert) system. The server uses axios to make HTTP requests to the official alert system's API, and then broadcasts any new alerts to connected clients using Socket.io.
Please consider donating or contributing your ideas into this project. Hosting a server requires money and any support would be greatly appreciated. Thank you for your support!
This project was created for educational purposes.
You can host this on your own or you can use my live version at wss://alerts.yalihart.com
.
*The api is only accessible within Israel.
-
Install Node.js and npm on your system if you haven't already.
-
Clone the repository or download the source code.
-
Open a terminal or command prompt and navigate to the project directory.
-
Install the project dependencies by running
npm install
command. -
Start the server by running
npm run
command. The server should now be running on port 8080 (You can configure the port insrc/app.js
).You can now connect to the server using the client-side socket.io library and listen for incoming alerts.
Refer to the Socket.io Client Reference
To sum it up:
const { io } = require("socket.io-client");
const socket = io("wss://alerts.yalihart.com");
socket.on('alert', (alert) => {
console.log(alert);
});
{
"type": "ALERT",
"timestamp": 1683995327666,
"cat": 1,
"location": {
"id": 235,
"name": "סעד",
"lat": 31.4702,
"lng": 34.5344
}
}
type
- indicates the type of message in this case ALERT
timestamp
- a unix timestamp of when the Socket.io server sent the data
cat
- (catagory is a refrence to other resources such as polygons and translations):
-
Category 1 - Missiles
-
Category 2 - Hostile aircraft intrusion
-
Category 3 - Non-conventional
-
Category 4 - Warning
-
Category 5 - Memorial day 1
-
Category 6 - Memorial day 2
-
Category 7 - Earthquake alert 1
-
Category 8 - Earthquake alert 2
-
Category 9 - Radiological event
-
Category 10 - Terrorist infiltration
-
Category 11 - Tsunami
-
Category 12 - Hazardous Materials Event
location
(represents information about the alerted location) :
id
- a reference used to get information from other resources
-
name
- the name of the area that is being alerted (can also be used to get information from other resources like translations & coordinates) -
lat
- exactly what is sounds like, latitude of the alerted areas -
lon
- longitude of the alerted areas (I think you got it)
If you have any If you have any questions or concerns, please feel free to open an issue or contact me at [email protected]