Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Jul 15, 2024 via pnpm

websocket 1.0.7

Websocket Client & Server Library implementing the WebSocket protocol as specified in RFC 6455.
Package summary
Share
2
issues
1
critical severity
license
1
1
high severity
meta
1
1
license
1
N/A
Package created
5 Jul 2011
Version published
12 Aug 2012
Maintainers
1
Total deps
1
Direct deps
0
License
UNKNOWN

Issues

2

1 critical severity issue

critical
Recommendation: Check the package code and files for license information
via: websocket@1.0.7
Collapse
Expand

1 high severity issue

high
via: websocket@1.0.7
Collapse
Expand

Licenses

N/A

N/A
1 Packages, Including:
websocket@1.0.7
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of websocket 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does websocket do?

The package "websocket" is a client and server library that implements the WebSocket protocol as per RFC 6455 specification. This allows real-time communication between a client and a server. The JavaScript implementation is designed to work with Node.js and supports the WebSocket protocol versions 8 and 13. It's capable of handling and aggregating received fragmented messages, fragmenting outgoing messages, tuning settings and more. It also supports a W3C WebSocket API for applications running on both Node and browsers.

How do you use websocket?

To use the "websocket" package, you first need to install it using npm with the command npm install websocket executed in your project root. You can then require it in your code using var WebSocketServer = require('websocket').server;.

Here's an example of how to set up a simple WebSocket server:

var WebSocketServer = require('websocket').server;
var http = require('http');

var server = http.createServer(function(request, response) {
    console.log((new Date()) + ' Received request for ' + request.url);
    response.writeHead(404);
    response.end();
});

server.listen(8080, function() {
    console.log((new Date()) + ' Server is listening on port 8080');
});

wsServer = new WebSocketServer({
    httpServer: server,
    autoAcceptConnections: false
});

wsServer.on('request', function(request) {
    var connection = request.accept('echo-protocol', request.origin);
    console.log((new Date()) + ' Connection accepted.');
    connection.on('message', function(message) {
        if (message.type === 'utf8') {
            connection.sendUTF(message.utf8Data);
        }
    });
    connection.on('close', function(reasonCode, description) {
        console.log((new Date()) + ' Peer ' + connection.remoteAddress + ' disconnected.');
    });
});

This code creates an HTTP server and associates a new WebSocketServer with it, listening on port 8080.

Where are the websocket docs?

The detailed API documentation for the "websocket" package can be found in the docs folder on the GitHub repository. The link is here: git+https://github.com/theturtle32/WebSocket-Node/docs/index.md. It provides comprehensive information about the WebSocket Client, Server Implementation for Node with various examples and use-cases.