<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.14.0 -",
    "tvOS: 11.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 4.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreBluetooth",
  "identifier" : "/documentation/CoreBluetooth/CBPeripheralManager/publishL2CAPChannel(withEncryption:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Bluetooth"
    ],
    "preciseIdentifier" : "c:objc(cs)CBPeripheralManager(im)publishL2CAPChannelWithEncryption:"
  },
  "title" : "publishL2CAPChannel(withEncryption:)"
}
-->

# publishL2CAPChannel(withEncryption:)

Creates a listener for incoming L2CAP channel connections.

```
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

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:)`](/documentation/CoreBluetooth/CBPeripheralManagerDelegate/peripheralManager(_:didPublishL2CAPChannel:error:)). L2CAP channels aren’t discoverable by themselves, so it’s the app’s responsibility to handle PSM discovery on the client.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)