DeveloperClient
enables inspection and debugging RoomClient
through message logs. It listens for developer.log
messages from the server and emits them locally as RoomLogEvent
objects.
DeveloperClient
– A high-level client that listens for developer.log
events and provides methods to watch, unwatch, and send developer logs.DeveloperClient
in your code:
DeveloperClient
developer.log
events and provides methods to enable, disable, and log custom developer messages.
room: RoomClient
RoomClient
, which handles the underlying communication with the server.log(type: string, data: Record<string, any>)
developer.log
message to the server with the specified type and data. This can be used to track custom logs, diagnostics, or other developer-related messages in your application.
type
– A string identifying the log level or category, such as "info"
, "warn"
, or "debug"
.data
– A JSON-serializable object containing additional details for the log entry.type
and data
into a message, then sends it to the server. This message is typically consumed by developers or other backend listeners for debugging or monitoring purposes.
enable()
developer.log
events.
developer.watch
message to the server to start receiving developer.log
events. If the server is configured to honor these watch requests, it will begin sending any future developer logs to this client.disable()
developer.log
events.
developer.unwatch
message to the server to stop receiving developer.log
events. Further developer logs from the server will be ignored until enable()
is called again.DeveloperClient
extends an EventEmitter<RoomLogEvent>
. It emits a "log"
event whenever a developer.log
message is received from the server. You can listen to these events as follows:RoomClient
DeveloperClient
uses the same Protocol
instance attached to RoomClient
to send and receive developer-related messages. If RoomClient
is disconnected, messages will not be delivered.
RoomClient
may throw an exception (e.g., RoomServerException
). Handle it accordingly in your code:
DeveloperClient
to include additional developer-oriented features, such as profiling, advanced filtering, or forwarding logs to other services.