RoomClient: project property
Available since
@irtio/client 5.0BrowsersNodeThe project read-only property of the RoomClient interface is the URL of the room’s project, which room URLs resolve against.
Value
A string: the room’s url without its room ID, ending in /, such as "https://rooms.irt.io/my-game/".
Description
The project URL comes from the room’s URL, not from the project option or the page’s irt-project meta tag, so a client connected to an absolute URL has the project of that URL. Pass it as the project of createRoom(), dataClient() or another connect() to reach the same project from code that has no meta tag, such as a Node script.
Examples
Opening a second room of the same project
A Node bot that was given one room’s absolute URL connects to the project’s lobby too.
// bot.ts
import { connect } from "@irtio/client";
const match = await connect("https://rooms.irt.io/my-game/match-17");
const lobby = await connect("lobby", { project: match.project });
console.log(`in ${match.id} and ${lobby.id}`);
See also
Runtime availability
| Browsers | Node | |
|---|---|---|
project | 5.0 | 5.0 |