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:
Can anybody help me to solve my problem? Thanks.