Connection: protocol property

Available since @irtio/room 0.1Hosted roomsirt dev@irtio/testingSelf-hosted room host

The 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:

  • rtt needs protocol 3 or later; it’s undefined before 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 roomsirt dev@irtio/testingSelf-hosted room host
protocol0.10.10.10.1