@@ -4,7 +4,7 @@ class SepiaSttSocketClient {
44
55 constructor ( serverUrl , clientId , accessToken , engineOptions , serverOptions ) {
66 this . serverUrl = ( serverUrl || "http://localhost:20741" ) . replace ( "\/$" , "" ) ;
7- this . socketHost = this . serverUrl . replace ( / ^ ( h t t p ) / , "ws" ) ;
7+ this . socketHost = this . serverUrl . replace ( / ^ ( h t t p ) / , "ws" ) + "/socket" ; //note: '/socket' is a path alias for proxies
88 this . clientId = clientId || "any" ;
99 this . accessToken = accessToken || "test1234" ;
1010
@@ -59,8 +59,11 @@ class SepiaSttSocketClient {
5959 //--- HTTP Interface ---
6060
6161 pingServer ( successCallback , errorCallback ) {
62- fetch ( this . serverUrl + "/ping" )
63- . then ( function ( res ) { return res . json ( ) ; } )
62+ const controller = new AbortController ( ) ;
63+ setTimeout ( ( ) => controller . abort ( ) , 8000 ) ;
64+ fetch ( this . serverUrl + "/ping" , {
65+ signal : controller . signal
66+ } ) . then ( function ( res ) { return res . json ( ) ; } )
6467 . then ( function ( json ) {
6568 if ( successCallback ) successCallback ( json ) ;
6669 } )
@@ -70,8 +73,11 @@ class SepiaSttSocketClient {
7073 }
7174
7275 loadServerInfo ( successCallback , errorCallback ) {
76+ const controller = new AbortController ( ) ;
77+ setTimeout ( ( ) => controller . abort ( ) , 8000 ) ;
7378 fetch ( this . serverUrl + "/settings" , {
74- method : "GET"
79+ method : "GET" ,
80+ signal : controller . signal
7581 } ) . then ( function ( res ) {
7682 if ( res . ok ) {
7783 return res . json ( ) ;
0 commit comments