1.0.7 • Published 3 months ago

@serenityjs/raknet-socket v1.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

Raknet Socket

About

Raknet socket is a bare-bones UDP socket that is written in Rust and uses NAPI-RS to export Node native modules for our Typescript and Javascript use!.

Usage

Raknet socket has a super simple and straight forward api for quick and easy setup.

import { Socket } from '@serenityjs/raknet-socket';

// Creates a new udp socket
const socket = new Socket('0.0.0.0', 19132);

// Starts listening for packets
socket.listen(
	(error, packet) => {
		// Incoming packet
		const buffer = Buffer.from('hello world!');
		socket.send(buffer, packet.address, packet.port, packet.version);
	},
	(error, packet) => {
		// Outgoing packet
		console.log('sent packet with size', packet.buffer.length);
	},
);

// Closes the socket
socket.close();
1.0.7

3 months ago

1.0.6

4 months ago

1.0.5

4 months ago

1.0.4

4 months ago

1.0.3

5 months ago

1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago

0.0.5

5 months ago

0.0.4

5 months ago

0.0.3

5 months ago

0.0.1

5 months ago

0.0.0

5 months ago