Hello, I am learning NWConnection and I have studied the TicTacToe app example. I am learning by creating my own app. I am trying to create a remote mouse app (the mouse/keyboard input from iPhone) over WiFi to control my Mac.
My MacBook starts a NWListener and waits for connection. My iPhone starts a NWBrowser and I connect to a the BrowseResult. I can make a successful TCP with TLS connection with no problem thanks to the TicTacToe example.
I figured out how to move the mouse but my main goal is to get a more smooth remote mouse control.
First, I can successfully send data from my iPhone. The data I'm sending is from the DragGesture onChanged value I obtain on a View. Now everytime I drag on my View it sends Data of two Double values x and y, 16 bytes.
On the receiving end, my Macbook receives the Data and successfully parses each of the messages and then moves the mouse using Quartz Display Services API. I implemented my own NWFramerImplementation and I can parse the message easily since I know the length of my payload data is always the same.
I get consistent smooth mouse movement when testing it on my iPad everytime, but when I use my iPhone it is horrible and there is a lot of lag/latency. I've tried using UDP on the connection and it's still the same. I turn off the data and bluetooth on my iPhone and it doesnt help
Where should I go from here?