tidwall / SwiftWebSocket

Fast Websockets in Swift for iOS and OSX
MIT License
1.53k stars 247 forks source link

cannot connect with a server #133

Closed y-ich closed 6 years ago

y-ich commented 6 years ago

Hi.

Thank you for your nice library.

I am trying to use SwiftWebSocket via SwiftPM to make a command line tool on macOS. I tried "echoTest" in Example section of README.md but never worked. No open events. And I found that it worked if you do the same code on Quick test framework. (I also tried it on XCTest and it does not work.) What is happening? I am confused very much. Do I need any preparations before creating a WebSocket? (The above is due to my misunderstanding of waitForExpectations. So currently, my problem is, that my command cannot connect with a server though I can connect on test framework.)

I made reproduction code. https://github.com/y-ich/SwiftWebSocket-reproduction (You need to run a local web socket server. I used a initial template of Meteor app)

Could you give me any suggestions to resolve it? Thanks.

y-ich commented 6 years ago

The default eventQueue is main_queue and it causes some kind of dead lock. if I create a DispatchQueue for eventQueue, it works.