class I3::Message

Overview

Represents a message exchanged during a Connection.

Message instances are of one of the following types:

Defined in:

i3/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
i3/message.cr

Constant Summary

MAGIC = "i3-ipc"

The magic bytes that identify all i3 IPC messages.

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(type, payload = "") #

Creates a new Message with the given type and payload.


[View source]

Class Method Detail

def self.from_io(io, format = Fmt) #

Creates a new instance of Message from the given IO.

Raises an Error on any parsing failure.


[View source]

Instance Method Detail

def event? #

Returns whether the current message is an event.


[View source]
def payload : String #

The message's payload, as a string.


[View source]
def size : Int32 #

The size of the message, in bytes.


[View source]
def to_io(io, format = Fmt) #

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


[View source]
def to_s(io) #

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


[View source]
def type : MessageType | ReplyType | EventType #

The type of the message.


[View source]