Connection: protocol property
Available since
@irtio/room 0.1Hosted roomsirt dev@irtio/testingSelf-hosted room hostThe protocol read-only property of the Connection interface is the version of the client protocol the connection speaks, which depends on the version of @irtio/client the player runs.
Value
A whole number.
Description
Some features need a newer client:
rttneeds protocol 3 or later; it’sundefinedbefore that.room.handoff()needs protocol 4 or later for every player it moves, and rejects otherwise.
A room can check protocol to tell a player with an old client to update before it needs one of these.
Examples
Asking an old client to update
// update-check.ts
import { defineRoom } from "@irtio/room";
export default defineRoom({
onJoin(room, connection) {
if (connection.protocol < 4) room.send(connection, { type: "update-needed" });
},
});
See also
Runtime availability
| Hosted rooms | irt dev | @irtio/testing | Self-hosted room host | |
|---|---|---|---|---|
protocol | 0.1 | 0.1 | 0.1 | 0.1 |