-
Notifications
You must be signed in to change notification settings - Fork 1.5k
add webrtc stream #436
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
base: main
Are you sure you want to change the base?
add webrtc stream #436
Conversation
|
@fufesou any idea? |
|
Please make this as an optional feature. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request adds WebRTC transport support to the project, enabling peer-to-peer connections using the WebRTC protocol alongside existing TCP and WebSocket options. The implementation includes endpoint detection, connection establishment via SDP offer/answer exchange, and a stream wrapper that integrates with the existing Stream enum.
Key Changes:
- Added
webrtccrate dependency (v0.14.0) and implemented aWebRTCStreamwrapper with send/receive methods - Extended the
Streamenum and connection logic to detect and handlewebrtc://prefixed endpoints - Included an example demonstrating WebRTC data channel usage
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/webrtc.rs | New WebRTC stream implementation with connection management, SDP handling, and data channel I/O operations |
| src/stream.rs | Extended Stream enum to include WebRTC variant and added corresponding method dispatching |
| src/socket_client.rs | Added WebRTC endpoint detection and connection initiation in the TCP connection flow |
| src/lib.rs | Exposed the new webrtc module as a public API |
| examples/webrtc.rs | Example code demonstrating WebRTC peer connection setup and data channel communication |
| Cargo.toml | Added webrtc dependency and dev dependencies for the example |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Like which kind of optional, cargo build features? |
|
YES |
|
Also, please write a working example for this webRTC stream. |
|
I don't think it will affect other well-functioning code. It will only be activated when encountering specific webrtc:// connection endpoints. |
Yea, I would try it, since we need a signal server here, it's not a simple example |
|
You can do a simple mock signal server. |
It will increase the binary size (disk space) and build time (cpu usage) if some one do not need this feature. webrtc is not a small crate.
Yes, this is another reason. |
|
Remove all Only mutex unwrap is allowed. |
fix read/write issue clear sessions after close
|
example updated |
|
please put webrtc_dummy in examples/webrtc.rs |
we need this in stream.rs when webrtc feature disabled |
Why? Can not use #[cfg(feature = "webrtc")]? I suggest you ask chatgpt. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 21 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
lichon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed all in next patch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 21 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
webrtc session clean fallback Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
|
Update here, I build a rustdesk web terminal, both websocket and webrtc works fine with this patch |
Code? |
add api to get webrtc stream
|
What TURN server do you use? |
|
It's webrtc P2P |
|
If you need a relay, just disable webrtc, websocket relay still works |
|
have you ever tested TURN? |
|
500MB free plan here: metered.ca |
This pull request introduces WebRTC support to the project, allowing connections to be established using the WebRTC protocol in addition to existing TCP and WebSocket options. The main changes include adding new dependencies, implementing a WebRTC stream wrapper, updating the connection logic to detect and handle WebRTC endpoints
These changes collectively add WebRTC support as a first-class transport option, expanding the range of protocols supported by the project and providing a foundation for further development and testing of WebRTC-based features.
Any idea?