| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Warning
This library is still under development and considered a beta. While it's being actively used in production by some games, the API can change. Make sure to get in touch if you want to go live with this so we can keep you up-to-date about changes.
True Peer-to-Peer (P2P) Networking
UDP Performance
Easy to Use
Production Ready
yarn add @poki/netlib
# or
npm install @poki/netlibimport { Network } from '@poki/netlib'
const network = new Network('<your-game-id>')// Create a new lobby
network.on('ready', () => {
network.create()
})
// Or join an existing one
network.on('ready', () => {
network.join('ed84')
})// Send messages
network.broadcast('unreliable', { x: 100, y: 200 })
// Receive messages
network.on('message', (peer, channel, data) => {
console.log(`Received from ${peer.id}:`, data)
})For more detailed examples and API documentation:
Your Game
↓
Netlib API
↓
WebRTC DataChannels
↓
(STUN/TURN if needed)
↓
UDP Transport
While Poki provides hosted STUN/TURN and signaling services for free, you can also self-host these components:
Set up your own signaling server
Using the provided Docker image:
$ docker build -t netlib .
$ docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -p 8080:8080 -e ENV=local netlibOr by running the signaling server binary directly:
$ go build -o signaling cmd/signaling/main.go
$ ENV=local ./signalingFor persistent storage remove ENV=local and set DATABASE_URL to your PostgreSQL database URL.
Configure your own STUN/TURN servers.
Initialize the network with custom endpoints:
const network = new Network('<game-id>', {
signalingServer: 'wss://your-server.com',
stunServer: 'stun:your-stun.com:3478',
turnServer: 'turn:your-turn.com:3478'
})Defold integration by IndieSoft.
We welcome contributions! Please see our Contributing Guide for details. This project adheres to the Poki Vulnerability Disclosure Policy.
This project is licensed under the MIT License - see the LICENSE file for details.
| Back | FazBrowse Home | New Git URL |