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

@poki/netlib

v0.0.14

Published

<img align="right" src="https://raw.githubusercontent.com/poki/netlib/main/.github/logo.png" width=140> The Poki Networking Library is a peer-to-peer library for web games, using WebRTC datachannels to provide UDP connections between players directly. Lik

Downloads

69

Readme

The Poki Networking Library   

Project Status: alpha

This library is still under heavy development and considered in alpha. The library API can and will change without warning and without bumping the major version. Make sure to get in touch if you want to go live with this netlib.

One missing feature that is next on the roadmap is lobby listing and discovery. Currently you can only connect peers by having players share a lobby code externally.

Library main advantages:

  • peer-to-peer (p2p)
    Clients connected to each other using this netlib will be connected directly without a central server in between (unless using the fallback TURN server). This has three main advantages:
    1. No server costs, there is no server running the game.
    2. No double implementation of the game. You don't need to write your game logic twice (for the client and the server).
    3. When players are living close by the latency is often a lot lower than when connected via a server
  • UDP
    Most web games rely on WebSockets or HTTP for communication which is always a TCP connection, but for realtime multiplayer games the UDP protocol is preferred. The main reason is:
    When one packet is slow or dropped UDP doesn't pause new, already received, packets, this is great for things like position updates. The Poki netlib also supplies a reliable data channel useful for chat or npc spawn events.

Setup

First add @poki/netlib as a dependency to your project:

# either using yarn:
yarn add @poki/netlib
# or using npm:
npm i @poki/netlib

Then you can import and create a Network interface:

import { Network } from '@poki/netlib'
const network = new Network('<your-game-id-here>')

(any random UUID is a valid game-id, but if your game is hosted at Poki you should use Poki's game-id)

Next up: read the basic usage guide and make sure to checkout the example code.

STUN, TURN & Signaling Backend

The netlib is a peer-to-peer networking library which means players are connected directly to each other and data send between them is never send to a server.
That said, to setup these connections we need a signaling service. This backend and STUN/TURN servers are hosted by Poki for free. You can however always decide to host the backend yourself.

Main Contributors