HAConnectionInfo

public struct HAConnectionInfo : Equatable

Information for connecting to the server

  • Certificate validation handler

    Declaration

    Swift

    public typealias EvaluateCertificate = (SecTrust, (Result<Void, Error>) -> Void) -> Void
  • Create a connection info

    URLs are in the form of: https://url-to-hass:8123 and /api/websocket will be appended.

    Throws

    If the URL provided is invalid in some way, see CreationError

    Declaration

    Swift

    public init(url: URL, userAgent: String? = nil, evaluateCertificate: EvaluateCertificate? = nil) throws

    Parameters

    url

    The url to connect to

    userAgent

    Optionally change the User-Agent to this

    evaluateCertificate

    Optionally override default SecTrust validation

  • url

    The base URL for the WebSocket connection

    Declaration

    Swift

    public var url: URL
  • The URL used to connect to the WebSocket API

    Declaration

    Swift

    public var webSocketURL: URL { get }
  • The user agent to use in the connection

    Declaration

    Swift

    public var userAgent: String?
  • Declaration

    Swift

    public static func == (lhs: HAConnectionInfo, rhs: HAConnectionInfo) -> Bool