pion / example-webrtc-applications

Examples of WebRTC applications that are large, or use 3rd party libraries
https://pion.ly/
MIT License
1.06k stars 248 forks source link

how use webrtc Establish a kcp p2p/E2E connection and communicate #117

Closed hktalent closed 2 years ago

hktalent commented 2 years ago

how use webrtc Establish a kcp p2p/E2E connection and communicate

Sean-Der commented 2 years ago

Hey @hktalent

WebRTC doesn't support KCP. You can only use RTP over SRTP or SCTP over DTLS.

thanks!

hktalent commented 2 years ago

Hey @hktalent

WebRTC doesn't support KCP. You can only use RTP over SRTP or SCTP over DTLS.

thanks!

I know, it is udp nat, kcp is over udp @Sean-Der thanks

Sean-Der commented 2 years ago

You could possibly send KCP over DataChannels? If you start a repo happy to help.

You can't send UDP or DTLS traffic directly unfortunately.

hktalent commented 2 years ago

You could possibly send KCP over DataChannels? If you start a repo happy to help.

You can't send UDP or DTLS traffic directly unfortunately.

I want to get my own udp addr and port through webrtc, and then notify another node through p2p. Similarly, the other node is the same, so that both nodes know each other's ip and port, and can establish kcp

@Sean-Der Thanks

Sean-Der commented 2 years ago

If you are ok with this only working with Pion you could do something like https://github.com/Sean-Der/pion-webrtc-shared-socket

That gives you access to the socket directly on each side. You can establish a WebRTC connection and get the NAT Traversal+Signaling.

Then you can call Send on the socket with your outbound traffic when you know the remote's IP/Port. When it arrives you can intercept the traffic here before it goes into pion/webrtc

hktalent commented 2 years ago

ok,thanks