SocketServer: QtObject

import Quickshell.Io

Unix socket server. More

Properties

Detailed Description

Example

SocketServer {
  active: true
  path: "/path/too/socket.sock"
  handler: Socket {
    onConnectedChanged: {
      console.log(connected ? "new connection!" : "connection dropped!")
    }
    parser: SplitParser {
      onRead: message => console.log(`read message from socket: ${message}`)
    }
  }
}

Property Details

active: bool

If the socket server is currently active. Defaults to false.

Setting this to false will destory all active connections and delete the socket file on disk.

If path is empty setting this property will have no effect.

handler: Component

Connection handler component. Must creeate a Socket.

The created socket should not set connected or path or the incoming socket connection will be dropped (they will be set by the socket server.) Setting connected to false on the created socket after connection will close and delete it.

path: string

The path to create the socket server at.

Setting this property while the server is active will have no effect.