Posts

Post marked as solved
2 Replies
Thanks for the response and link!
Post not yet marked as solved
7 Replies
Hi can you add an example of an actuall subclasses ARAnchor with with custom properties and the encodable / decodable methods
Post marked as solved
8 Replies
Thank you for the help! Without you I would be lost right now.Much appreciated and take care 🙂
Post marked as solved
8 Replies
hi meaton,I thought a lot about what you said about the compexitiy of everyone being advertiser & browser and I decided for now I'm going to just stick with Multipeer Connectivity. I have to do more more research into getting what I want accomplished.I finally got a good grasp on your excellent code but I do have a couple of questions about it:-at the bottom of the p2p2Connection class on line 45 you have receiveIncomingDataOnConnection(). Is this supposed to be a delegate method that I create?// Setup the receive method to ensure data is captured on the incoming connection. receiveIncomingDataOnConnection()-in that same p2p2Connection class, in the p2p2Connection.stateUpdateHandler = { newState in } on lines 20 & 21 case .ready os_log("Connection established"), can't I use this .ready state to send and receive data? I found a couple of samples of people doing this on Stackoverflow.// Here is where you could potentially react to failures in connecting to the endpoint discovered by your browser p2p2Connection.stateUpdateHandler = { (newState) in switch (newState) { case .ready: //The connection is established and ready to send and recieve data. self.sendPaket("Hello") self.receive() default: } } func sendPaket(_ packet:String) { let packetData = packet.data(using: .utf8) self.connection?.send(content: packetData, completion: NWConnection.SendCompletion.contentProcessed(({ (error) in if let err = error { print("Sending error \(err)") } else { print("Sent successfully") } }))) } // once data is received use a delegate method to send it to the the vc that's using this class func receive() { self.connection?.receiveMessage(completion: { (data, context, isComplete, error) in if let err = error { print("Recieve error: \(err)") return } if let rcvData = data, let str = String(data:rcvData, encoding: .utf8) { print("Received: \(str) now pass it over to the delegate method") } }) }
Post marked as solved
8 Replies
Hi meaton,I've been going over this code for hours and searching around the internet for help. I'm starting to understand the flow, I should have something ready by later today. I wanted to ask a question about a point you brought up:> if all of your clients truly need to be peer-to-peer with each other then Multipeer Connectivity framework is what you are looking forwith the code you added, why can't I have each client act as host and guest? Once they are discovered they share their data and once they discover someone else they pull that data. I don't know enough about networking to know if that creates other problems.The Multipeer Connectivity api which MCSession and has a peer limit of 8 peers. Im creaitng a shared experience for ARKit. Initally I thought that the peer limit had something to do with ARKit but as I did more research I found out that even creating a messaging app MCSession will still limit you to 8 peers. That's where the probelm comes in with Multipeer Connectivity, it's easier to use but you have the hard limit. I haven't found anything on the internet that explains why it has that hard 8 peer limit even though it's built on top of Bonour which has no limit. It reminds me of the UIImagePicker or a UITableView which is easier to use but you lose the flexibility of the much more difficult AVFoundation or a UICollectionView.
Post marked as solved
8 Replies
Hi meaton,Thanks for the reply. Sorry for the late response, I've been working on some ARKit related stuff and it had me consumed since yesterday. I have to meticulously go through this answer and try to understand it as I'm new to networking. I have some questions but I want to get a better understanding of the flow before I ask anything (I might be able to figure them out on my own). I'll send you an updated reponse by Wed evening,ttys and thanks agiain!Lance
Post marked as solved
2 Replies
Eskimo,Thanks for the reply.I don't think I need to use Bonjour + UDP because I don't think video is getting shared although I could be wrong. I didn't see anything in the docs about the Multiuser AR Experience framework nor the Collabrative session framework sharing videos. I think the 8 peer limit is for people who want to create action oriented games like SwiftShot so that there won't be any latency issues. They can get up and going fast almost like UIImagePicker vs AVFoundation. Again I could be worng.I posted the other questions in the gaming section. Once I find out exactly what is being shared (the object, node, and anchor or the entire scene with all 3) and I get an idea of the data size I'll max the number of users based on that. I can't test as of yet because I still haven't figured out how to connect the users and share data once Bonjour discovers them. I posted a question about it.As far as the local Wi-Fi environment I would think that wether I use Bonjour + TCP or Multiuser AR Experience or the Collabrative frameworks the conditions would be based on outside factors more so then either framework itself. Either way you are 100% correct I need to do user testing.On a side note the downside of testing with ARKit is you need actual physical devices and for what I'm doing lots of them 😟.Appreciate the help, thank you!Lance