Contents

connect(endpoint:)

Establishes a streaming connection at the provided endpoint.

Declaration

@MainActor final func connect(endpoint: FoveatedStreamingSession.Endpoint = .systemDiscovered) async throws

Parameters

  • endpoint:

    The streaming endpoint to connect to.

Discussion

You can establish a streaming connection in a variety of ways:

// Connect by discovering nearby endpoints.
try await session.connect(endpoint: .systemDiscovered)

// Connect directly with IP address and port number.
try await session.connect(endpoint: .local(ipAddress: "125.125.125.125", port: 55000))

// Connect to a remote cloud endpoint by specifying a server name
// which corresponds to an entry in the `ApprovedStreamingEndpoints` dictionary in Info.plist.
try await session.connect(endpoint: .remote(serverName: "My Remote Server", signalingHeaders: ["test-header": "my-test"])

You can stop establishing a connection by cancelling the task or calling disconnect().