Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] Add Support for Dynamic Signaling Server Management #68

Open
2 tasks
KiddoV opened this issue Nov 14, 2024 · 0 comments
Open
2 tasks

[FEAT] Add Support for Dynamic Signaling Server Management #68

KiddoV opened this issue Nov 14, 2024 · 0 comments
Assignees

Comments

@KiddoV
Copy link

KiddoV commented Nov 14, 2024

Checklist

[x] Are you reporting a bug? Use github issues for bug reports and feature requests. For general questions, please use https://discuss.yjs.dev/
[x] Try to report your issue in the correct repository. Yjs consists of many modules. When in doubt, report it to https://github.com/yjs/yjs/issues/

Is your feature request related to a problem? Please describe.
Currently, it requires reinitializing the provider whenever a signaling server needs to be added or removed. Since y-webrtc is a peer-to-peer module, it would make sense to allow signaling servers to be dynamically managed without disrupting existing connections.

In many peer-to-peer communication applications, a central server is not necessary. Each peer could potentially host its own signaling server. Enabling dynamic signaling server management would improve flexibility, especially when peers join and leave, allowing new servers to be added or removed as needed.

Describe the solution you'd like
I would like the y-webrtc provider to support dynamically managing signaling servers. This would allow signaling servers to be added or removed on-the-fly, keeping the provider and existing connections intact, and adapting to peer changes in a decentralized setup without needing a full provider reinitialization.

API suggestion:

// Initialize the provider with an initial list of signaling servers
const provider = new WebrtcProvider('my-room-name', yDoc, {
    signaling: ['wss://signaling-server-1.com', 'wss://signaling-server-2.com'],
});

// Add a new signaling server dynamically without reinitializing the provider
provider.addSignalingServer('wss://new-signaling-server.com'); //=> ['wss://signaling-server-1.com', 'wss://signaling-server-2.com', 'wss://new-signaling-server.com']

// Remove an existing signaling server by URL
provider.removeSignalingServer('wss://signaling-server-1.com'); //=> ['wss://signaling-server-2.com', 'wss://new-signaling-server.com']

// Optionally, provide a list of signaling servers to reset or replace the current list
provider.setSignalingServers([
    'wss://another-server.com',
    'wss://yet-another-server.com'
]); //=> ['wss://another-server.com', 'wss://yet-another-server.com']

Describe alternatives you've considered
One alternative is to continue reinitializing the provider each time a signaling server needs updating. However, this disrupts all active connections, requiring reconnections and causing delays and potential data inconsistencies during the reinitialization process.

Additional context
Supporting dynamic signaling server management would make real-time, decentralized collaborative applications more robust, particularly in scenarios where signaling servers are peer-hosted and can change frequently. Allowing servers to be added or removed as peers join or leave would enhance resilience and scalability, reducing reliance on a central server.

  • I'm a sponsor 💖
  • This feature is critical for my project.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants