<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "IOBluetooth",
  "identifier" : "/documentation/IOBluetooth/IOBluetoothL2CAPChannelRegisterForChannelCloseNotification(_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "IOBluetooth"
    ],
    "preciseIdentifier" : "c:@F@IOBluetoothL2CAPChannelRegisterForChannelCloseNotification"
  },
  "title" : "IOBluetoothL2CAPChannelRegisterForChannelCloseNotification(_:_:_:)"
}
-->

# IOBluetoothL2CAPChannelRegisterForChannelCloseNotification(_:_:_:)

Allows a client to register for a channel close notification.

```
func IOBluetoothL2CAPChannelRegisterForChannelCloseNotification(_ channel: IOBluetoothL2CAPChannelRef!, _ callback: IOBluetoothUserNotificationCallback!, _ inRefCon: UnsafeMutableRawPointer!) -> Unmanaged<IOBluetoothUserNotificationRef>!
```

## Parameters

`channel`

The target L2CAP channel

`callback`

Callback to be called when the L2CAP channel is closed.

`inRefCon`

Client-supplied refCon to be passed to the callback.

## Return Value

Returns an IOBluetoothUserNotificationRef representing the outstanding L2CAP channel close notification. To unregister the notification, call IOBluetoothUserNotificationUnregister() with the returned IOBluetoothUserNotificationRef. If an error is encountered creating the notification, NULL is returned. The returned IOBluetoothUserNotificationRef will be valid for as long as the notification is registered. It is not necessary to retain the result. Once the notification is unregistered, it will no longer be valid.

## Discussion

The given callback will be called when the L2CAP channel is closed.

---

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)