TakahikoKawasaki / nv-websocket-client

High-quality WebSocket client implementation in Java.
Apache License 2.0
2.03k stars 292 forks source link

Implement socket timeout for handshaking process #214

Closed MinnDevelopment closed 3 years ago

MinnDevelopment commented 3 years ago

Sometimes the connection can get stuck here. The library has no way to allow users to set a timeout for this part.

I've decided to add a method to configure a socket timeout in the WebSocketFactory.

Fixes #213

vlasky commented 3 years ago

@TakahikoKawasaki being able to set an optional timeout on a read() call on the socket object seems like a really useful feature to have in nv-websocket-client. It would allow certain failure conditions to be handled far more gracefully.

In the current code, a blocking read will sit there indefinitely and never time out.

Do you have any concerns with merging this pull request?

TakahikoKawasaki commented 3 years ago

@vlasky Sorry. I'm just too busy to maintain this open source library in a timely manner.

TakahikoKawasaki commented 3 years ago

@MinnDevelopment @vlasky nv-websocket-client 2.14 including this PR was released just now. Thank you for your contribution!