okhttpclient に WebSocket のping Interval を指定するようにした

This commit is contained in:
tateisu 2017-07-06 19:38:12 +09:00
parent 88596fceaa
commit 515048365d
5 changed files with 8 additions and 6 deletions

View File

@ -37,7 +37,7 @@
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

View File

@ -290,6 +290,7 @@ public class App1 extends Application {
.connectTimeout( 30, TimeUnit.SECONDS )
.readTimeout( 30, TimeUnit.SECONDS )
.writeTimeout( 30, TimeUnit.SECONDS )
.pingInterval( 10, TimeUnit.SECONDS )
.connectionSpecs( spec_list );
ok_http_client = builder.build();

View File

@ -47,10 +47,10 @@ class AppState {
AppState( Context applicationContext, SharedPreferences pref ){
this.context = applicationContext;
this.handler = new Handler();
this.pref = pref;
this.density = context.getResources().getDisplayMetrics().density;
this.stream_reader = new StreamReader( applicationContext, pref );
this.handler = new Handler();
this.stream_reader = new StreamReader( applicationContext, handler, pref );
loadColumnList();
}

View File

@ -784,7 +784,6 @@ class ColumnViewHolder
log.d( "restoreScrollPosition [%d] %s , column has no saved scroll position.", page_idx, column.getColumnName( true ));
return;
}
column.scroll_save = null;

View File

@ -42,6 +42,8 @@ class StreamReader {
final String end_point;
final LinkedList< Callback > callback_list = new LinkedList<>();
Reader( SavedAccount access_info, String end_point ){
this.access_info = access_info;
this.end_point = end_point;
@ -216,10 +218,10 @@ class StreamReader {
final SharedPreferences pref;
private final Handler handler;
StreamReader( Context context, SharedPreferences pref ){
StreamReader( Context context, Handler handler,SharedPreferences pref ){
this.context = context;
this.pref = pref;
this.handler = new Handler();
this.handler = handler;
}
private Reader prepareReader( @NonNull SavedAccount access_info, @NonNull String end_point ){