#1411·gun

webrtc room should not default to hash/path

Author: eyalerCreated Aug 28, 2025Updated Dec 1, 2025

webrtc.js room defaults to the hash or path if no room is specified: opt.rtc.room = opt.rtc.room || GUN.window && (location.hash.slice(1) || location.pathname.slice(1));

This is not well documented, and while for some apps already using the hash as the graph node key this makes sense, in a more general scenario this can be very suprising and cause some issues:

  1. the hash/path is silently leaked, which is a privacy issue
  2. bad hashes can cause errors in sea modules running on peers e.g. Object { "#": "fmhk6VELS", "@": "JVy9cxro9", err: "Unverified data.", _: _(). not sure if this was due to some bad chars or due to my hash being 150k chars long... so maybe don't grab my hash by default ;)
  3. my app uses hashes for internal state, so different clients would not connect over webrtc before i learned i should set a common room key