npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@rbxts/net-ts

v2.1.8

Published

You can use with both RobloxTS and Plain LuaU

Downloads

2

Readme

NetTS

You can use with both RobloxTS and Plain LuaU

installation and importing

RobloxTS

npm install @rbxts/net-ts

Import

import Net from '@rbxts/net-ts'
const net = new Net()

Roblox LuaU

local Net = require(game.ReplicatedStorage.Net).default
local net = Net.new()

Events Usage

Server -> Client

To send data on Server to specific player, you have to specify _player property.

Client

net.addListener('random-event-name', ({ property1, property2 }) => {
    print(`First param: ${property1}, Second param: ${property2} `)
}, true)

Server

net.emit('random-event-name', { property1: 'example', property2: game.GetService("Workspace"), _player: game.GetService("Players").FindFirstChild("Monotter") as Player }, true)

Server -> Clients

if you do not specify _player it will automatically call FireAllClients.

Client

net.addListener('broadcast', ({ property1, property2 }: { property1: string, property2: Instance }) => {
    print(property2, property1)
}, true)

Server

net.emit('broadcast', { property1: 'example', property2: game.GetService("Workspace") }, true)

Client -> Server

if you do not specify _player it will automatically call FireAllClients.

Client

net.addListener('kick-itself', ({ reason, _player }: { reason: string, _player: Player }) => {
    _player.Kick(reason)
}, true)

Server

net.emit('kick-itself', { reason: 'uwu' })

Server -> Server, Client -> Client

Server / Client

net.addListener('randomEvent', ({ a, c }: { a: string, c: string[] }) => {
    print(`b: ${a}, [d,e,f]: ${c} `)
})

Server / Client

net.emit('randomEvent', { a: 'b', c: ['d', 'e', 'f'] })

Function Usage

Function Usage only returns value of first returned listener.

Client <-> Client, Server <-> Server
// Sender
const result = net.emit('add', { num1: 20, num2: 11 }, false, true) // -> To making it function, simply add true at last parameter
print(result) // -> Result will be printed. ;)
// Receiver
net.addListener('add', ({ num1, num2 }: { num1: number, num2: number }) => {
    return num1 + num2 // -> now we can use return
})

Server -> Client

Server -> Client

// Receiver
net.addListener('multiply', ({ num1, num2 }: { num1: number, num2: number }) => {
    return num1 * num2
}, true)
// Sender
const result = net.emit('multiply', { num1: 2, num2: 5, _player: game.Players.Monotter }, true, true)
print(result)

Important Notice

I did not test examples that specified on here so there is a might be a issue on that