Skip to content

Comments

Add capability to support configuration#13

Open
jasonzhang0413 wants to merge 1 commit intoLivePersonInc:masterfrom
jasonzhang0413:master
Open

Add capability to support configuration#13
jasonzhang0413 wants to merge 1 commit intoLivePersonInc:masterfrom
jasonzhang0413:master

Conversation

@jasonzhang0413
Copy link

We are leveraging this project to easily set up web socket server end point. We have found the connection between web socket server and client will automatically drop when there is no activity for five minutes. The five minutes is the default idle timeout setting in jetty web socket implementation. We are required to make the persistent connection once the connection is established. Connection dropping means something goes wrong on either server or client side. We want to prevent this automatically disconnect by introducing configuration.
Please let me know if this is considered a valid request.

@coveralls
Copy link

Coverage Status

Coverage decreased (-2.6%) to 80.583% when pulling ecf75bd on jasonzhang0413:master into b3695a8 on LivePersonInc:master.

@black-snow
Copy link

looks good to me

@zuozhiw
Copy link

zuozhiw commented Nov 17, 2020

In case anyone is wondering the same question, here's my solution:

Add the following code inside the run function provided by dropwizard

WebSocketUpgradeFilter webSocketUpgradeFilter = WebSocketUpgradeFilter.configureContext(environment.getApplicationContext());
webSocketUpgradeFilter.getFactory().getPolicy().setIdleTimeout(100000);
environment.getApplicationContext().setAttribute(WebSocketUpgradeFilter.class.getName(), webSocketUpgradeFilter);

you can also easily set other configurations after getPolicy()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants