
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
http-websocket-server
Advanced tools
A simple command line http-server with websocket routing. Built with socket.io as websocket framework with an added layer for simplified client communication.
Quickly build sites with client communication without writing any server code.
Install globally with npm:
npm install -g http-websocket-server
Start a server with:
http-websocket-server [server-root] [--port=port]
Connect to an application from the client by specifying the applications id.
// socket.io library is served by default from the server
<script src="/socket.io/socket.io.js"></script>
<script>
var appId = 'myApp';
var socket = io();
var myConnectionId;
socket.on('connect', function() {
// This is my id which other clients can reference
myConnectionId = socket.io.engine.id;
// Connect to the appId you wish to use
socket.emit('app.connect', {
appId: appId
});
});
socket.on('app.connect', function() {
console.log('Connected to app: ' + appId);
});
</script>
Broadcasting messages to other clients in the same server-app.
socket.on('app.connect', function() {
socket.emit('app.emit', {
event: 'hello', // Event name that other clients listen to
data: {
name: 'My name'
}
});
});
// Listen to "hello" message from other clients
socket.on('hello', function(data) {
console.log(data.name + ' says hello');
});
Sending messages to a specific client
socket.on('app.connect', function() {
socket.emit('app.connections');
});
socket.on('app.connections', function(data) {
var firstClient = data.connections[0];
if (firstClient) {
socket.emit('app.emit', {
event: 'special hello',
to: firstClient.id,
data: {
message: 'A special hello to you from me'
}
});
}
});
socket.on('special.hello', function(data) {
console.log('A special message received: ' + data.message);
});
FAQs
Simple http-server with websocket bindings
The npm package http-websocket-server receives a total of 1 weekly downloads. As such, http-websocket-server popularity was classified as not popular.
We found that http-websocket-server 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.