class

I3::Message

Inherits Reference < Object

Represents a message exchanged during a Connection.

Message instances are of one of the following types:

  • MessageType - sent by the client to the i3 IPC server
  • ReplyType - sent by the i3 IPC server to the client as a response
  • EventType - sent by the i3 IPC server to the client as an event

Constants

MAGIC = "i3-ipc"

The magic bytes that identify all i3 IPC messages.

Constructors

new(type : I3::Message::EventType | I3::Message::MessageType, payload : String = "")

Creates a new Message with the given type and payload.

Source

Class methods

from_io(io, format = Fmt)

Creates a new instance of Message from the given IO.

Raises an Error on any parsing failure.

Source

Instance methods

event?

Returns whether the current message is an event.

Source
payload

The message's payload, as a string.

Source
size

The size of the message, in bytes.

Source
to_io(io, format = Fmt)

Writes this instance to the given IO, in the format used by i3.

Source
to_s(io)

Write a human-friendly representation of this Message to the given IO.

Source
type

The type of the message.

Source

Nested types