---
title: "publishL2CAPChannel(withEncryption:)"
framework: corebluetooth
role: symbol
role_heading: Instance Method
path: "corebluetooth/cbperipheralmanager/publishl2capchannel(withencryption:)"
---

# publishL2CAPChannel(withEncryption:)

Creates a listener for incoming L2CAP channel connections.

## Declaration

```swift
func publishL2CAPChannel(withEncryption encryptionRequired: Bool)
```

## Parameters

- `encryptionRequired`: doc://com.apple.documentation/documentation/Swift/true if the service requires link encryption before a stream can be established. doc://com.apple.documentation/documentation/Swift/false if the service supports use over an unsecured link.

## Discussion

Discussion The system determines an unused Protocol and Service Multiplexer (PSM) at the time of publishing, and provides it to your app with peripheralManager(_:didPublishL2CAPChannel:error:). L2CAP channels aren’t discoverable by themselves, so it’s the app’s responsibility to handle PSM discovery on the client.

## See Also

### Using L2CAP Channels

- [unpublishL2CAPChannel(_:)](corebluetooth/cbperipheralmanager/unpublishl2capchannel(_:).md)
