Thank you! Would you be able to provide a simple example on how to use NWConnectionGroup with QUIC and peer to peer and star architecture?
Im confused on what to put for the with param in the NWConnectionGroup initializer.
https://developer.apple.com/documentation/network/nwconnectiongroup/init(with:using:)
I believe i will put my NWParameters that contains all my TLS1.3 stuff for the using param
Would i use an endpoint discovered in my browser for the with param?
let nwcg = NWConnectionGroup(with: endpoint, using: parameters)
If that is the case wont an NWConnectionGroup only be created when the device ID of the browsing device is larger than the discovered peer?
So the device that gets connected to via its listener wouldn't have a NWConnectionGroup?
Also, would I have a NWConnectionGroup for each peer im connected to?
I may have a picture of how things would work...
As you know i have a concept of a device controller. So if I have three devices connected to each other (not in a star configuration - more server client) there will be a single controller.
Device A is the controller
Device B gets controlled
Device C gets controlled
Device A -> Device B
Device A -> Device C
Device B <-XXXX-> Device C (no connection between device B and C)
Since device A is the controller I will only start its NWBrowser and i will add the discovered endpoints to my Endpoints class that conforms to NWGroupDescriptor
final class Endpoints: NWGroupDescriptor {
var members: [NWEndpoint]
init(endpoints: [NWEndpoint]) {
self.members = endpoints
}
}
Device B and C i will only start their listeners
if device B wants to be come the leader then maybe a sequence of messages could passed between device B and A and this will result in Device A stopping its NWBrowser and starting its NWListener and device B stopping its NWListener and starting its NWBrowser.
Topic:
App & System Services
SubTopic:
Networking
Tags: