---
title: "addingConnections(from:)"
framework: wifiaware
role: symbol
role_heading: Type Method
path: "wifiaware/wapublisherlistener/action/addingconnections(from:)"
---

# addingConnections(from:)

Makes additional network connections over a preexisting Wi-Fi Aware data path without publishing or advertising services over Wi-Fi Aware.

## Declaration

```swift
static func addingConnections(from pairedDevices: WAPublisherListener.Devices) -> WAPublisherListener.Action
```

## Parameters

- `pairedDevices`: The remote devices from which to accept connections. The NetworkListener isn’t activated if the system doesn’t specify any devices.

## Return Value

Return Value A new WAPublisherListener.Action that configures the listener to accept network connections from specified paired devices.

## Discussion

Discussion Set up your app’s first connection to a device using Wi-Fi Aware service discovery. Apps can do so by defining a single “control” service used for initial discovery and connection, and creating a NetworkListener for that service via connecting(to:from:datapath:). Subsequent connections may then use a .addingConnections NetworkListener to quickly connect without going through the service discovery process again. The framework limits the listener to accepting connections from the paired devices specified. important: Your app must have at least one pre-existing NetworkConnection to a remote device before it can make additional connections to an .addingConnections NetworkListener on that device. // Create a listener to add new connections. let listener = try NetworkListener(for:             .wifiAware(.addingConnections(from: .matching(devices))),         using: .parameters({              TCP() }))

// Get the port number once the listener is in the ready state. guard let port = listener.port { return }

// Send the port number to the client device or devices over the control connection.
