Post

Replies

Boosts

Views

Activity

Does a background thread only work when the app in on top in IOS swift?
I have a websocket server which executed on a background thread like this: DispatchQueue.global(qos: .userInteractive).async { let server = SecondServer() server.run() } But there is a problem. websocket server only responds to client commands when the app is on top. for example, when I run browser and send websocket command, the server doesn't respond until I bring my app on top. Is there any solution to help me that I can run my server on the background and my app doesn't need to be on top?
0
0
361
Nov ’21
swiftNIO websocket server doesn't work correctly on the backgound of UI
I used SwiftNIO as a websocket server according to this link, and it works fine when I execute it on the main thread but when I run it on the background of main thread like this DispatchQueue.global(qos: .userInitiated).async { let server = SecondServer() server.run() } it doesn't receive any message from client. this is my server code: My websocket server code Can anybody help me to solve my problem? Thanks.
2
0
1.1k
Nov ’21