---
title: "sendData(toAllPlayers:with:)"
framework: gamekit
role: symbol
role_heading: Instance Method
path: "gamekit/gkmatch/senddata(toallplayers:with:)"
---

# sendData(toAllPlayers:with:)

Transmits data to all players connected to the match.

## Declaration

```swift
func sendData(toAllPlayers data: Data, with mode: GKMatch.SendDataMode) throws
```

## Parameters

- `data`: The bytes to send.
- `mode`: The mechanism used to send the data.

## Mentioned in

Exchanging data between players in real-time games

## Discussion

Discussion The match queues the data and transmits it when the network becomes available.

## See Also

### Sending data to other players

- [chooseBestHostingPlayer(completionHandler:)](gamekit/gkmatch/choosebesthostingplayer(completionhandler:).md)
- [send(_:to:dataMode:)](gamekit/gkmatch/send(_:to:datamode:).md)
- [GKMatch.SendDataMode](gamekit/gkmatch/senddatamode.md)
