listen_socket#

ignis.utils.Utils.listen_socket(sock: socket) Generator[str, None, None]#

Listen to the socket. This function is a generator.

Parameters:

sock (socket) -- An instance of a socket.

Return type:

Generator[str, None, None]

Returns:

A generator that yields responses from the socket.

Example usage:

with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as sock:
    sock.connect("path/to/socket.sock")

    for message in Utils.listen_socket(sock):
        print(message)