I can’t speak to the state of MQTT libraries, but I can address the issue of servers in general.
It’s possible for an iOS app to include a server component but running that server in the background is not possible in the general case. For a server to work the app must not be suspended (see Technote 2277 Networking and Multitasking for more background on this). iOS provides no general-purpose mechanism for an app to run indefinitely in the background, and thus no easy way to run a server reliably.
So, if your app is running indefinitely in the background for some other reason, implementing a server within your app should be straightforward. But for most apps, which get suspended shortly after moving to the background, implementing a server that runs while they’re in the background is not feasible.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"