Socket SO_ERROR [61: Connection refused]

Hi,

I’m trying out the tutorial on Ch 30 WebSockets by Logan Wright from the Book ‘Server-Side Swift with Vapor’. Tried the final share-touch-server and -phone projects and got it to work the first time in the simulator. Now that I try to repeat it in the simulator I’m getting an error ShareTouch[2327:194087] [connection] nw_socket_handle_socket_event [C1.1:2] Socket SO_ERROR [61: Connection refused]. I’m using the shareSessionURL of ws://localhost:8080/session. Please if you could advise.

Thanks.

Just before the above error it has another:
ShareTouch[11326:728230] [] nw_protocol_get_quic_image_block_invoke dlopen libquic failed

Perhaps this has something to do with it?

Is that coming from the simulator or Vapor? A connection refused error means it can’t connect to what it’s trying to connect to. Is the Vapor app definitely running? Can you connect to it from a different client?

Hi, it’s from the simulator. Tried a few different ones with same result. Thanks.

Think I got it. The websocket connects with ./echo not ./session

1 Like

replace URL(string: “http://localhost:8080/littlejohn/symbols”) with URL(string: “http://127.0.0.1:8080/littlejohn/symbols”)

1 Like

I had the same problem and corrected with your suggestion. 127 & co., inc. worked like a charm!
Thanks!