Hacker News Digest

25 августа 2025 г. в 09:48 • oxism.com • ⭐ 197 • 💬 59

OriginalHN

#webrtc#bittorrent#nostr#mqtt#ipfs#supabase#firebase#p2p#javascript#serverless

Make any site multiplayer in a few lines. Serverless WebRTC matchmaking

Trystero — безсерверный WebRTC-матчмейкинг.
Добавь мультиплеер в пару строк.

Прямо сейчас все на этой странице соединяются напрямую и синхронизируют курсоры и клики.
Поддерживаются BitTorrent, Nostr, MQTT, IPFS, Supabase, Firebase.

Пример:

import {joinRoom} from 'trystero'
const room = joinRoom({appId: 'trystero-lounge'}, '101')

room.onPeerJoin(addCursor)
room.onPeerLeave(removeCursor)

const [sendMove, getMove] = room.makeAction('mouseMove')
const [sendClick, getClick] = room.makeAction('click')

window.addEventListener('mousemove', e => sendMove([e.clientX, e.clientY]))
window.addEventListener('click', () => sendClick(randomFruit()))

getMove(([x, y], id) => setCursorPosition(id, x, y))
getClick((fruit, id) => dropFruitFrom(id, fruit))

Также доступны аудио/видео-потоки и файлы.