security-union / videocall-rs

teleconference system written in rust
https://www.videocall.rs
MIT License
1.36k stars 117 forks source link

Factor out web media connection into model::connection::Connection #105

Closed ronen closed 1 year ago

ronen commented 1 year ago

[Another step towards #74]

@darioalessandro: I haven't tested this with WebTransport -- I don't know how.

Even in main I can't/don't know how to get webtransport working?!

So the WebTransport parts of this PR are all of the hopeful vein "if it compiles it probably works" -- I didn't write any real new logic it's all just rearranging the existing code, so that's got a reasonable chance of being true :) But of course you should test it. And/or can you explain how to run with webtransport locally on my mac?

Here's what's in the PR:

Pulled all the relevant code out of attendants.rs into model/connection/* including eliminating a bunch of yew Messages that had been used to set up the WebTransport connection.

In doing the refactoring, organized the code into a few levels of abstraction. From the bottom up, they are:

darioalessandro commented 1 year ago

hey @ronen !! are you facing cert issues? if so, please launch chrome with https://github.com/security-union/videocall-rs/blob/main/launch_chrome.sh make sure that you launch chrome first, then the API so that certs match

griffobeid commented 1 year ago

You can also use https://transport.rustlemania.com:443 I believe to avoid launching chrome with that script

ronen commented 1 year ago

Thanks, but I don't get as far as cert issue :)

My question is more basic: How do I even run with WebTransport enabled?

My intent to run with the server on my local machine, trying it out by connecting a few times to http://localhost/meeting/username/room from several Chrome tabs with various usernames.

I normally just run:

$ make up

Which only attempts a Websocket connection. I've tried

$ WEBTRANSPORT_ENABLED=1 make up

But then the server seems to crash and the web pages don't load at all. I haven't dug into it to figure out why, just assumed I'm doing something wrong.

What is the proper way to run with WebTransport?

darioalessandro commented 1 year ago

Try with the cloud version first:

https://rustlemania.com/meeting/ronen/ronen-meeting/true

The last true is the webtransport feature (I know, pretty horrible).

Screenshot 2023-07-19 at 12 28 17 AM

Once you can see that it is working, try:

http://localhost/meeting/ronen/ronen-meeting/true

You can set the server to point to prod so that you do not need to launch chrome with crazy flags

ronen commented 1 year ago

(Sorry for slow response. I'm traveling with only intermittent time & web access.)

I can successfully connect to rustlemania.com with webtransport true. But I haven't been able to do it locally in main. Chrome console error:

Failed to establish a connection to https://127.0.0.1:4433/lobby/other/asdf: net::ERR_QUIC_PROTOCOL_ERROR.QUIC_NETWORK_IDLE_TIMEOUT (No recent network activity after 4010240us. Timeout:4snum_undecryptable_packets: 0 {}).
yew-ui-6accc82abf3e650e.js:472 Failed to read incoming unidirectional streams WebTransportError: Opening handshake failed.

also, in the terminal the messages from make up include a bunch of rust warnings both for dev-websocket-api and dev-webtransport-api, and a runtime panic:

docker-webtransport-api-1  | thread 'main' panicked at 'expected HEALTH_LISTEN_URL to be set: NotPresent', src/bin/webtransport_server.rs:22:10

Can you give me really basic step-by-step instructions for how to get main to compile and run cleanly locally, with webtransport working? Thanks!

ronen commented 1 year ago

Hi, I saw #108 go by that addresses HEALTH_LISTEN_URL -- and with that I was able to get WebTransport working in main running locally (using the script to set the certs). Yay!

So I merged the latest main into this PR, and now have verified that both WebSocket and WebTransport are working in this PR. (Yay again!)

So AFAICT this PR is ready for you to look at / try out yourself.

darioalessandro commented 1 year ago

@ronen fantastic!! I'll do that