<!--
{
  "availability" : [
    "iOS: 18.4.0 -",
    "iPadOS: 18.4.0 -",
    "macCatalyst: 18.4.0 -",
    "macOS: 15.4.0 -",
    "visionOS: 2.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WKWebExtension/MessagePort",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(cs)WKWebExtensionMessagePort"
  },
  "title" : "WKWebExtension.MessagePort"
}
-->

# WKWebExtension.MessagePort

An object that manages message-based communication with a web extension.

```
@MainActor class MessagePort
```

## Overview

Contains properties and methods to handle message exchanges with a web extension.

## Topics

### Errors

[`WKWebExtension.MessagePort.Error.Code`](/documentation/WebKit/WKWebExtension/MessagePort/Error/Code)

Constants that indicate errors in the [`WKWebExtension.MessagePort`](/documentation/WebKit/WKWebExtension/MessagePort) domain.

[`errorDomain`](/documentation/WebKit/WKWebExtension/MessagePort/errorDomain)

A string that identifies the error domain.



---

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)