
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
api-websocket-bridge
Advanced tools
API WebSocket Bridge is a Node.js application that provides a WebSocket server for real-time communication. It allows clients to connect and exchange data using the WebSocket protocol
API WebSocket Bridge is a Node.js application designed to be run in a Docker container. It constantly refreshes an API at a set interval and distributes WebSocket (WSS) events to connected clients.
Before running the API WebSocket Bridge, make sure you have the following:
To run the API WebSocket Bridge in a Docker container, follow these steps:
cd websocket-driver
Configure the API WebSocket Bridge by editing the config.json file located in the config directory. Refer to the 'Configuration' section below for details on how to customize the configuration based on your requirements and the API you are working with.
Build the Docker image.
docker build -t websocket-driver .
docker run -d -p 8080:8080 --name websocket-container \
-v /path/to/cert/fullchain.pem:/app/cert/fullchain.pem \
-v /path/to/cert/privkey.pem:/app/cert/privkey.pem \
-v /path/to/config:/app/config \
websocket-driver
Make sure to replace /path/to/cert with the path to your SSL certificate and key files, and /path/to/config with the path to your config.json file.
The WebSocketDriver application relies on a configuration file (config.json) to specify various settings. Below is an example configuration that corresponds to the example response from Salty Bet's API:
{
"certPath": "/app/cert/fullchain.pem",
"keyPath": "/app/cert/privkey.pem",
"port": 8080,
"updateInterval": 5000,
"apiUrl": "https://www.saltybet.com/state.json",
"events": {
"teamNamesChange": {
"emitEvent": "teamNamesChange",
"params": ["p1name", "p2name"]
},
"betAmountChange": {
"emitEvent": "betAmountChange",
"params": ["p1total", "p2total"]
},
"statusChange": {
"emitEvent": "statusChange",
"params": ["status"]
},
"alertChange": {
"emitEvent": "alertChange",
"params": ["alert"]
},
"remainingChange": {
"emitEvent": "remainingChange",
"params": ["remaining"]
}
}
}
"certPath" and "keyPath" specify the file paths for the SSL certificate and private key respectively."port" defines the port number on which the WebSocket server will run."updateInterval" determines the interval (in milliseconds) at which the API will be checked for updates."apiUrl" specifies the URL of the API that provides the match information. In this case, it is Salty Bet's API endpoint (https://www.saltybet.com/state.json)."events" contains a mapping of event types to their corresponding configuration.The example response from Salty Bet's API:
{
"p1name": "Upset chieshen",
"p2name": "Brunestud arcueid",
"p1total": "0",
"p2total": "0",
"status": "open",
"alert": "",
"x": 0,
"remaining": "78 more matches until the next tournament!"
}
The configuration defines five events with their respective emitEvent names and associated parameters. These events allow you to subscribe to specific changes in the API response:
teamNamesChange: Triggers when the names of the players change ("p1name" or "p2name").betAmountChange: Triggers when the total bet amounts change ("p1total" or "p2total").statusChange: Triggers when the match status changes ("status").alertChange: Triggers when there is an alert or message change ("alert").remainingChange: Triggers when the number of matches remaining changes ("remaining").These events provide flexibility in handling specific updates and allow you to emit WebSocket events accordingly.
Please make sure to modify the configuration file (config.json) according to your requirements and the API you are working with.
To set up the project for development, follow these steps:
cd api-websocket-bridge
npm install
npm start
The API WebSocket Bridge will now be running on your local machine.
This project is licensed under the Apache 2.0.
This project makes use of the following packages:
We would like to express our gratitude to the authors and maintainers of these packages for their valuable contributions to the open-source community.
FAQs
API WebSocket Bridge is a Node.js application that provides a WebSocket server for real-time communication. It allows clients to connect and exchange data using the WebSocket protocol
The npm package api-websocket-bridge receives a total of 6 weekly downloads. As such, api-websocket-bridge popularity was classified as not popular.
We found that api-websocket-bridge demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.