<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Network",
  "identifier" : "/documentation/Network/WebSocket/maximumMessageSize(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Network"
    ],
    "preciseIdentifier" : "s:7Network9WebSocketV18maximumMessageSizeyACSiF"
  },
  "title" : "maximumMessageSize(_:)"
}
-->

# maximumMessageSize(_:)

Set the maximum allowed message size to be received by the WebSocket
connection.

```
func maximumMessageSize(_ size: Int) -> WebSocket
```

## Parameters

`size`

The maximum message size.

## Discussion

This does not limit the sending message size.

A maximum message size of 0 means there is no receive limit. The
default maximum message size is 0.

---

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)