Want shorter URLs?
Hiya. Peer to peer WebRTC is an interest of mine, too.
I hate the beacons. They're stupidly long, and they don't conveniently fit into URLs.
So I wrote an extremely aggressive parser compressor for beacons, which gets them small enough to go into URLs in a reasonable way.
Heavy example
By example, here's Chrome 92's host beacon on Windows 10.
Original 1866 bytes, packed 337 bytes, URL encoded 577 characters
{"type":"offer","sdp":"v=0
o=- 1199580080461629164 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE 0
a=extmap-allow-mixed
a=msid-semantic: WMS
m=application 59267 UDP/DTLS/SCTP webrtc-datachannel
c=IN IP4 73.162.196.213
a=candidate:2254048910 1 udp 2122262783 2601:645:8400:6c20:a0ed:463d:b3d9:2e5b 59265 typ host generation 0 network-id 2
a=candidate:794956039 1 udp 2122197247 2601:645:8400:6c20::a610 59266 typ host generation 0 network-id 3
a=candidate:1191081017 1 udp 2122129151 10.0.0.163 59267 typ host generation 0 network-id 1
a=candidate:3293969885 1 udp 2122063615 172.18.80.1 59268 typ host generation 0 network-id 4
a=candidate:3282507946 1 udp 2121998079 172.30.0.1 59269 typ host generation 0 network-id 5
a=candidate:3423470964 1 udp 2121932543 172.21.32.1 59270 typ host generation 0 network-id 6
a=candidate:2782917333 1 udp 1685921535 73.162.196.213 59267 typ srflx raddr 10.0.0.163 rport 59267 generation 0 network-id 1
a=candidate:3369726590 1 tcp 1518283007 2601:645:8400:6c20:a0ed:463d:b3d9:2e5b 9 typ host tcptype active generation 0 network-id 2
a=candidate:1642196471 1 tcp 1518217471 2601:645:8400:6c20::a610 9 typ host tcptype active generation 0 network-id 3
a=candidate:142444745 1 tcp 1518149375 10.0.0.163 9 typ host tcptype active generation 0 network-id 1
a=candidate:2329280813 1 tcp 1518083839 172.18.80.1 9 typ host tcptype active generation 0 network-id 4
a=candidate:2368005210 1 tcp 1518018303 172.30.0.1 9 typ host tcptype active generation 0 network-id 5
a=candidate:2190342532 1 tcp 1517952767 172.21.32.1 9 typ host tcptype active generation 0 network-id 6
a=ice-ufrag:h2zg
a=ice-pwd:rLDrcPyQHODnE5SBbDM0vAHf
a=fingerprint:sha-256 F2:7A:3A:54:09:D3:6B:62:39:A2:21:5E:87:92:12:90:7C:D9:9C:F6:CC:9B:A4:62:BD:99:59:18:88:F7:92:BD
a=setup:actpass
a=mid:0
a=sctp-port:5000
a=max-message-size:262144
"}
And here it is compressed and URL encoded:
KASQRQIwqwUAAHAxQGoEgAUCAyB4dsCoABJgEABkmAYAKIAhcANkQAUC3AYgLwDNAmwDoA2pVoNmCSXABlABEwBgAMiyApQGGAXQH4AMQDGAN6UyyAiAFIAEAHAAlAHOAwQApSOAGEAtAHAA4zAA-AH8XAH+4BwBA9wB6ACMzGyDA8MwHACCFAg4AP4AXAE4ggF8cMIVnTAIIAFUAX4BdoIAfcoAQBzp2gnUAcoAMACqggG9y4AcAUOACABmfYHyggC9yqgcPKgBcVQB9gCeoTAATMrDSZ0qnTAAcAAm+A8DML1CIwrgAJjhbgEMAIdsADvr1SYUwnwAzHAANhWEoACIAk69zgpPgBGOEAKIAa5gALSvNphdqfAAscIAsQASAAnXle4zCwE+AFY4RlqQBPuivNZhKifABscAARAALL4rADmcCIACcADIAEUVAGN0ABPACKAAkAPKqgB2NHZAGUAELxVUAWQADAA3ACC+oAZnBaQcVgAuAAqAEgAMsAa3ihTAAEIAHoAcIASagAAktPgAHIAb3MANkAEviAF6AJkATQGiOBCcLAFgAPCBgDQQA
Practical example
This is a more modern Chrome 120 host beacon from Windows 11, about 1/5 the size.
Original 488 bytes, packed 95 bytes, URL encoded 204 characters
{ "type": "offer", "sdp": "v=0
o=- 2567065588211027114 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE 0
a=extmap-allow-mixed
a=msid-semantic: WMS
m=application 9 UDP/DTLS/SCTP webrtc-datachannel
c=IN IP4 0.0.0.0
a=ice-ufrag:RgDu
a=ice-pwd:rZiEmiBHAHvzyVcAlraBu/kh
a=ice-options:trickle
a=fingerprint:sha-256 7B:86:40:3D:2E:56:D5:A4:EC:40:E5:AC:E8:93:53:BA:3A:BD:F8:65:61:40:D9:EA:59:B8:00:76:7D:51:20:03
a=setup:actpass
a=mid:0
a=sctp-port:5000
a=max-message-size:262144
" }
Which becomes
ADCAGAGQGIAKBgCxAWATgGIFUCBQAQBEAUgAgBwASmAEgAKYAIgCUBzAEQFdgACVALQCWAUQC2AgEIAJAIKSAbgC8AngDUAxtIA2qAIbiOAegDWAC2AAqACQBvAGEABALwA6FQFWAJQBv7AU4A1ABcAyQDKAF0AXAC9AB8Apjr2AJsAVwCaAB3AcgC+AIrc4ACwAPDUANBAA
These sizes will come down a lot soon, when I start removing fields from the beacon and seeing what still works (obviously an optional, non-default change)
Happy to accept a PR for this!