🔗 p2p
Shared WebRTC signaling for the browser games on santrancisco.net. Players on the same network find each other automatically; game traffic flows directly between devices.
import { joinRoom } from 'https://p2p.santrancisco.net/p2p.js?v=1';
const room = await joinRoom({ app: 'mygame', name: 'Alex' }); // same network
// const room = await joinRoom({ app: 'mygame', name: 'Alex', code: 'ABCD' });
room.on('peer-join', ({ peer }) => console.log(peer.name, 'joined'));
room.on('message', ({ from, data }) => console.log(from, data));
room.broadcast({ hello: 'world' });
- Nearby rooms group devices that share a public IP (or IPv6 /64).
- Room codes work across networks.
- If a direct connection can't be made, messages are relayed through the signaling server.
- Only pages on
*.santrancisco.netmay connect.
Used by Blind Hot Potato.