Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeout should be parameter #21

Merged
merged 2 commits into from Oct 17, 2016
Merged

Timeout should be parameter #21

merged 2 commits into from Oct 17, 2016

Conversation

tomohisa
Copy link
Contributor

@tomohisa tomohisa commented Oct 15, 2016

problem

5.seconds.fromNow() is too short for slack webSockecet Client.
Usually many server is use 20 second ping/pong setting, so it should be
longer than that. Otherwise it throw SocketConnectionError

Slack send ping pong like 20 second interval, so for websockets, this
should be like 1.minute.fromNow().

Fix

This PR made deadline (timeout second) to be parameter. Default timeout parameter is now 60.seconds

Result

I’ve tested and 5.seconds throw SocketConnectionError,
60.seconds.fromNow() can keep connection at least 2-3 hours

Merge-ability

This adds connectionTimeout parameter on WebSocket Class but it has default value
so it should not make API conflict or changes. Should be safe to tag it.

# problem
5.seconds.fromNow() is too short for slack webSockecet Client.
Usually many server is use 20 second ping/pong setting, so it should be
longer than that. Otherwise it throw SocketConnectionError

Slack send ping pong like 20 second interval, so for websockets, this
should be like 1.minute.fromNow().

# Fix
This PR made deadline (timeout second) to be parameter.

# Result
I’ve tested and 5.seconds throw SocketConnectionError,
60.seconds.fromNow() can keep connection at least 2-3 hours

# Merge-ability
This adds timeout parameter on WebSocket Class but it has default value
so it should not make API conflict or changes. Should be safe to tag it.
Copy link
Contributor

@Danappelxx Danappelxx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

@Danappelxx
Copy link
Contributor

The only worry I have is naming - is timeout good @paulofaria?

Other than that good to go :)

@paulofaria
Copy link
Contributor

I think maybe connectionTimeout is a better name.

@paulofaria
Copy link
Contributor

Any other suggestions?

@tomohisa
Copy link
Contributor Author

OK lemme change

timeout -> connectionTimeout
@tomohisa
Copy link
Contributor Author

changed @paulofaria @Danappelxx

@tomohisa tomohisa merged commit 3d6ff18 into master Oct 17, 2016
@tomohisa tomohisa deleted the better_dedline_parameter branch October 17, 2016 00:47
tomohisa pushed a commit to ZewoGraveyard/WebSocketClient that referenced this pull request Oct 18, 2016
# problem
5.seconds.fromNow() is too short for slack webSockecet Client.
Usually many server is use 20 second ping/pong setting, so it should be
longer than that. Otherwise it throw SocketConnectionError

Slack send ping pong like 20 second interval, so for websockets, this
should be like 1.minute.fromNow(). After the test, slack still does not
work with 60.seconds, so I would like to pass own value to
WebSocketClient

# Fix
This PR made deadline (timeout second) to be parameter. Default timeout
parameter is now `60.seconds`

ZewoGraveyard/WebSocket#21
Changed on WebSocket Package, but WebSocetClient does not have pass the
value, so User could not set own parameter. This change allow to set
own parameter if client wish

# Result
I’ve tested and 5.seconds throw SocketConnectionError,
60.seconds.fromNow() can keep connection at least 2-3 hours. For
production maybe I will use 10.minutes (But it depends on server so I
would like it to pass my own value)

# Merge-ability
This adds connectionTimeout parameter on WebSocketClient Class but it
has default value nil, and if its nil, WebSocketClient use WebSocket
default value.
so it should not make API conflict or changes. Should be safe to tag it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants