bluerobotics / bluerobotics/cockpit
Redesign WebrtcManager Class for Multiple Streams Support
- Dominant language
- TypeScript
- Stars
- 198
- Forks
- 63
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 57
Description
## Problem Statement
The current implementation of the `WebrtcManager` class appears to be single-use, limiting its functionality to handling a single stream at a time. I suggest that there is room for improvement in this aspect.
## Proposed Solution
### Redesign for Multiple Streams Support
I propose redesigning the `WebrtcManager` class to support multiple streams, allowing for a more flexible and scalable solution. The idea is to maintain the existing interface while enhancing the class to handle multiple instances of `startStream()`.
### Current Workflow
Currently, a new instance of the `WebrtcManager` class is created for each stream, which might not be the most efficient approach.
### Proposed Workflow
The redesigned class would still have the same interface, but the difference lies in the ability to support multiple `startStreams()` for different streams within a single class instance.
### Justification
The current single-use nature of the class might not be necessary since, in essence, the class represents a connection to the WebRTC server. The class receives server-specific information through constructor arguments, such as URL and configuration, and holds common attributes related to the server.
- Available streams
- Available ICE IPs
- Server address
- Connection configuration
- Signaller status
- ICEs to be used
### Implementation Details
I suggest transforming the part of the class that is currently single-use (e.g., `streamName`, `session`, and `mediaStream`) into an object/array to allow for a more composable and reusable structure.
### Additional Insights
@joaoantoniocardoso adds that reducing the number of simultaneous WebSocket connections would be beneficial for both cockpit and MCM as it reduces communication cluttering and resources usage.
### Benefits
- Improved efficiency in handling multiple streams.
- Enhanced scalability for future developments.
- Reduced resource usage with fewer simultaneous WebSocket connections.
- Easier development maintenance
This proposed solution also aligns with the original idea of making the `WebrtcManager` class composable, facilitating a more modular and maintainable codebase.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating the TypeScript WebrtcManager class and tracing its startStream() workflow, including streamName, session, mediaStream, and WebSocket handling. Define how multiple streams share one manager while preserving the existing interface, then verify that separate streams work and simultaneous WebSocket connections are reduced.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- audio-video-rtc
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100