{"library":"rtcmulticonnection-server","title":"RTCMultiConnection Socket.io Server","description":"RTCMultiConnection Socket.io Server (npm package `rtcmulticonnection-server`) is a server-side component designed to facilitate real-time communication using WebRTC, specifically for the RTCMultiConnection client-side library. Its primary function is to manage signaling over a Socket.io connection, enabling peers to discover each other and exchange necessary session descriptions and ICE candidates to establish peer-to-peer WebRTC connections. The current stable version is 1.3.3, though the most significant feature change occurred in version 1.3.1. This package does not follow a strict, frequent release cadence, with major updates appearing intermittently as needed to support the core RTCMultiConnection library. A key differentiator since version 1.3.1 is its shift from being an independent server application to a modular component that integrates seamlessly into existing Node.js applications that already utilize Socket.io. This design choice allows developers greater flexibility in incorporating WebRTC signaling into their custom server architectures, rather than being forced into a standalone solution. It specifically avoids creating its own HTTP or Socket.io servers, delegating that responsibility to the host application.","language":"javascript","status":"maintenance","last_verified":"Sun Apr 19","install":{"commands":["npm install rtcmulticonnection-server"],"cli":null},"imports":["const RTCMultiConnectionServer = require('rtcmulticonnection-server');","RTCMultiConnectionServer.addSocket(socket);"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const http = require('http');\nconst { Server } = require('socket.io');\nconst RTCMultiConnectionServer = require('rtcmulticonnection-server');\n\nconst app = http.createServer((req, res) => {\n    res.writeHead(200, { 'Content-Type': 'text/plain' });\n    res.end('RTCMultiConnection Server running. Connect via Socket.io.\\n');\n});\n\nconst io = new Server(app, {\n    cors: {\n        origin: \"*\", // Adjust for production security\n        methods: [\"GET\", \"POST\"]\n    }\n});\n\nio.on('connection', (socket) => {\n    console.log('Client connected:', socket.id);\n    RTCMultiConnectionServer.addSocket(socket);\n\n    socket.on('disconnect', () => {\n        console.log('Client disconnected:', socket.id);\n    });\n});\n\nconst PORT = process.env.PORT || 9001;\napp.listen(PORT, () => {\n    console.log(`Server listening on port ${PORT}`);\n});","lang":"javascript","description":"This example demonstrates how to integrate `rtcmulticonnection-server` into an existing Node.js HTTP server using `socket.io` for signaling, which is the recommended approach since version 1.3.1.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}