Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
udp2ws
Advanced tools
Readme
Relay UDP packets to WebSocket server
$ npm install --save udp2ws ws
import { Relay } from 'udp2ws';
const relay = new Relay({ port: 1234 });
relay.listen(3000, () => {
console.log('relay server listening on port 3000');
});
Create a new relay instance.
options
: Set of configurable options to set on the relay. Can have the following fields:
type
{string} Either 'udp4' or 'udp6'. Default:udp4
port
{number} Destination port.address
{string} Destination host name or IP address.exclusive
{boolean} Boolean value true or false. Default:false
multicastAddress
{string} The IP multicast group address.multicastInterface
{string} The local IP address associated with a network interface.wssOptions
{Object} Set of configurable options to set on the WebSocket server. Please see ws documentation for details.interceptor
{Function} Define the function to intercept incoming UDP packets.const relay = new Relay({
port: '1234',
multicastAddress: '224.0.0.114',
interceptor: (msg, rInfo) => {
// messages with longer length will not be relayed
if (msg.length <= 120) return msg;
},
});
Starts the relay (WebSocket) server listening for connections.
port
{number} The port where to bind the server.callback
{Function} Called when the server is listening for connections.Stops the relay (WebSocket) server from accepting new connections.
Accesses the dgram.Socket
instance, which is available when the relay server is started.
Accesses the ws.WebSocketServer
instance, which is available when the relay server is started.
FAQs
Relay UDP packets to WebSocket server
The npm package udp2ws receives a total of 24 weekly downloads. As such, udp2ws popularity was classified as not popular.
We found that udp2ws demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.