---
title: "peripheralManager(_:didPublishL2CAPChannel:error:)"
framework: corebluetooth
role: symbol
role_heading: Instance Method
path: "corebluetooth/cbperipheralmanagerdelegate/peripheralmanager(_:didpublishl2capchannel:error:)"
---

# peripheralManager(_:didPublishL2CAPChannel:error:)

Tells the delegate that the peripheral manager created a listener for incoming L2CAP channel connections.

## Declaration

```swift
optional func peripheralManager(_ peripheral: CBPeripheralManager, didPublishL2CAPChannel PSM: CBL2CAPPSM, error: (any Error)?)
```

## Parameters

- `peripheral`: The peripheral manager that published the channel.
- `PSM`: The Protocol/Service Multiplexer (PSM) of the published channel.
- `error`: The error that prevented publishing, or nil if no error occurred.

## Discussion

Discussion The peripheral manager calls this method after you call publishL2CAPChannel(withEncryption:). The PSM parameter contains the PSM assigned for the published channel.

## See Also

### Using L2CAP Channels

- [peripheralManager(_:didUnpublishL2CAPChannel:error:)](corebluetooth/cbperipheralmanagerdelegate/peripheralmanager(_:didunpublishl2capchannel:error:).md)
- [peripheralManager(_:didOpen:error:)](corebluetooth/cbperipheralmanagerdelegate/peripheralmanager(_:didopen:error:).md)
