---
title: "send(_:type:lastMessage:metadata:)"
framework: network
role: symbol
role_heading: Instance Method
path: "network/networkchannel/send(_:type:lastmessage:metadata:)"
---

# send(_:type:lastMessage:metadata:)

Send data on a connection.

## Declaration

```swift
func send<Content>(_ content: Content, type: Int, lastMessage: Bool = false, @ProtocolMetadataBuilder metadata builder: () -> [NWProtocolMetadata] = {[]}) async throws where Content : DataProtocol
```

## Parameters

- `content`: The data to send.
- `type`: The message type.
- `lastMessage`: The last message to send.
- `builder`: A builder for specifying metadata about the content to send.

## Discussion

Discussion This may be called before the connection is ready, in which case the send will be enqueued until the connection is ready to send.
