RoomClient: protocol property
Available since
@irtio/client 5.0BrowsersNodeThe protocol read-only property of the RoomClient interface is the version of the client protocol the connection speaks.
Value
A number: the newest version the client, the router and the room all speak, from the router’s answer to each connection. It’s 0 until the router accepts the first connection.
Description
A router or room that doesn’t speak a version this client accepts closes the connection with 4000; update @irtio/client. The room sees the same version as connection.protocol.
Examples
Logging the protocol on connect
A client logs the protocol version the room speaks once it’s connected.
// protocol.ts
import { connect } from "@irtio/client";
const room = await connect("main");
console.log(`room ${room.id} speaks client protocol ${room.protocol}`);
See also
Connection.protocol, the room’s side- Errors and close codes
Runtime availability
| Browsers | Node | |
|---|---|---|
protocol | 5.0 | 5.0 |