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
Deduplicate and refactor code #66
Comments
Thanks for the feedback! I agree with a lot of it. For some things there are reasons why it is the way it is, other times, it's just sloppiness/laziness/ignorance and there is definitely room for improvement :) I'll try to go through them one by one!
|
I guess one way to get a feeling for how a shared implementation would look would be to make a shared abstraction for a smaller part, like the data channels themselves for example. |
Thanks for the lengthy explanations and for sharing your thoughts about separate vs a single implementation! I have an idea how we can get rid of the wasm-specific implementation hopefully without measurable performance degradation and for sure without significantly increasing the build size but it will be a longer project. I will let you know how it goes and if it works like I imagine :) |
I think this is solved, so I'm suggesting we close this. @johanhelsing can have final say. |
Hi @simbleau, So it's definitely OK for me as well to close this issue and I will get back with it when I will have any updates. |
Agree, if we want to do this, opening a new issue would make it a lot clearer what's actually left to investigate. |
Adding complex new features like #64 is made more difficult because of mainly two issues in the code structure.
There are two versions of the WebRTC socket and all its components for two compile target (groups) - one for native and one for wasm. All work needs to be done twice and even if both code versions resemble each other in many ways there are also many differences
Most of the code lives in one huge file (per target) which is not too easy to understand - the code structure as it is now doesn't quite fit in my head and I find myself looping over and over through the code trying to understand how one thing affects the other and where the data is flowing. For example even after spending hours with it it's still not clear for me what is the main difference between
handshake_offer
andhandshake_accept
or the handling ofPeerEvent::NewPeer
andPeerEvent::Signal
and why they are so similar and if the code can be easily deduplicated or not. Or what exactly is the exact purpose of all the different senders and receivers.Ideally before starting some major refactoring work we can get rid of the separate code for wasm. Unfortunately
webrtc-rs
doesn't yet support wasm and it's not even planned but they opened an issue for that topic with a help wanted label suggesting that they are open to it:webrtc-rs/webrtc#351
I would be motivated to have a go at it if you also would be looking forward to use this later in matchbox and if you agree that this could dramatically reduce or even eliminate our wasm-specific code.
Please let me know what you think
The text was updated successfully, but these errors were encountered: