Skip to content

Instantly share code, notes, and snippets.

View luddilo's full-sized avatar

Ludvig Linse luddilo

View GitHub Profile
@luddilo
luddilo / distributed-mediasoup.js
Created August 30, 2021 13:42 — forked from gurupras/distributed-mediasoup.js
mediasoup horizontal scaling
onServerStartup () {
const { serverId, ip } = getServerInfo() // serverId does not change across restarts
this.serverId = serverId
// We don't have any routers or producers (yet). Clear any value that exists in the DB related to our serverId
clearSharedDB(serverId, 'routers')
clearSharedDB(serverId, 'producers')
// Update the DB with our serverId and ip so that others will know how to reach us
registerServerInDB(serverId, ip)