Stay organized with collections
Save and categorize content based on your preferences.
Once connections are established between devices, you can start exchanging data.
The exchanged data can take the form of a simple byte array, such as a short
text message; a file, such as a photo or video; or a stream, such as the audio
stream from the device’s microphone.
Data can be sent using the following connection manager instance methods:
send(_:to:)
startStream(_:to:)
sendResource(at:withName:to:)
The following connection manager delegate methods can be utilized when receiving
data.
Swift
extensionExample:ConnectionManagerDelegate{funcconnectionManager(_connectionManager:ConnectionManager,didReceivedata:Data,withIDpayloadID:PayloadID,fromendpointID:EndpointID){// A simple byte payload has been received. This will always include the full data.}funcconnectionManager(_connectionManager:ConnectionManager,didReceivestream:InputStream,withIDpayloadID:PayloadID,fromendpointID:EndpointID,cancellationTokentoken:CancellationToken){// We have received a readable stream.}funcconnectionManager(_connectionManager:ConnectionManager,didStartReceivingResourceWithIDpayloadID:PayloadID,fromendpointID:EndpointID,atlocalURL:URL,withNamename:String,cancellationTokentoken:CancellationToken){// We have started receiving a file. We will receive a separate transfer update// event when complete.}funcconnectionManager(_connectionManager:ConnectionManager,didReceiveTransferUpdateupdate:TransferUpdate,fromendpointID:EndpointID,forPayloadpayloadID:PayloadID){// A success, failure, cancelation or progress update.}}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-12 UTC."],[[["\u003cp\u003eAfter establishing connections between devices, data exchange can commence, encompassing various formats like byte arrays, files, or streams.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eConnectionManager\u003c/code\u003e offers methods such as \u003ccode\u003esend(_:to:)\u003c/code\u003e, \u003ccode\u003estartStream(_:to:)\u003c/code\u003e, and \u003ccode\u003esendResource(at:withName:to:)\u003c/code\u003e for initiating data transmission.\u003c/p\u003e\n"],["\u003cp\u003eTo receive data, implement the \u003ccode\u003eConnectionManagerDelegate\u003c/code\u003e protocol, providing methods to handle byte payloads, streams, file transfers, and transfer updates.\u003c/p\u003e\n"],["\u003cp\u003eWhile payloads of the same type maintain their sending order upon arrival, there's no guarantee of order preservation across different payload types.\u003c/p\u003e\n"]]],[],null,[]]