concept-collection / trystero-messaging-demo
trystero-messaging-demo / src / config.ts
17 lines · 919 BBlameHistoryRaw
1// A globally-unique identifier for THIS app. Trystero uses it (together with
2// the room id) to derive the Nostr topics peers use to find each other, so it
3// should be unique enough not to collide with other Trystero apps on the public
4// Nostr relays. Change this if you fork the demo.
5export const APP_ID = 'trystero-messaging-demo-7c1f9a'
7// The default room everyone lands in. Because the requirement is "whoever opens
8// the app sees everyone else", we put all visitors in one shared room by
9// default. You can still create a private room by adding `#myroom` to the URL.
10export const DEFAULT_ROOM = 'lobby'
12// Read the desired room id from the URL hash (e.g. https://.../#dev-room) so you
13// can demo multiple isolated rooms without any UI, falling back to the default.
14export const getRoomFromUrl = (): string => {
15 const hash = window.location.hash.replace(/^#/, '').trim()
16 return hash || DEFAULT_ROOM