class I3::Message
- I3::Message
- Reference
- Object
Overview
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 serverReplyType- sent by the i3 IPC server to the client as a responseEventType- sent by the i3 IPC server to the client as an event
Defined in:
i3/message.cri3/message/bar.cr
i3/message/config.cr
i3/message/event.cr
i3/message/output.cr
i3/message/rect.cr
i3/message/status.cr
i3/message/tree.cr
i3/message/version.cr
i3/message/workspace.cr
Constant Summary
-
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
Messagewith the given type and payload.
Class Method Summary
-
.from_io(io, format = Fmt)
Creates a new instance of
Messagefrom the givenIO.
Instance Method Summary
-
#event?
Returns whether the current message is an event.
-
#payload : String
The message's payload, as a string.
-
#size : Int32
The size of the message, in bytes.
-
#to_io(io, format = Fmt)
Writes this instance to the given
IO, in the format used by i3. -
#to_s(io)
Write a human-friendly representation of this
Messageto the given IO. -
#type : MessageType | ReplyType | EventType
The type of the message.
Constructor Detail
Creates a new Message with the given type and payload.
Class Method Detail
def self.from_io(io, format = Fmt)
#