File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ var directLine = new DirectLine({
5656 token: /* or put your Direct Line token here (supply secret OR token, not both) */ ,
5757 domain: /* optional: if you are not using the default Direct Line endpoint, e.g. if you are using a region-specific endpoint, put its full URL here */
5858 webSocket : /* optional: false if you want to use polling GET to receive messages. Defaults to true (use WebSocket). */ ,
59+ pollingInterval: /* optional: set polling interval in milliseconds. Default to 1000 */ ,
5960});
6061```
6162
Original file line number Diff line number Diff line change @@ -209,6 +209,7 @@ export interface DirectLineOptions {
209209 token ?: string ;
210210 domain ?: string ;
211211 webSocket ?: boolean ;
212+ pollingInterval ?: number ;
212213}
213214export declare class DirectLine implements IBotConnection {
214215 constructor ( options : DirectLineOptions ) ;
Original file line number Diff line number Diff line change @@ -221,7 +221,8 @@ export interface DirectLineOptions {
221221 secret ?: string ,
222222 token ?: string
223223 domain ?: string ,
224- webSocket ?: boolean
224+ webSocket ?: boolean ,
225+ pollingInterval ?: number
225226}
226227
227228const lifetimeRefreshToken = 30 * 60 * 1000 ;
@@ -261,6 +262,8 @@ export class DirectLine implements IBotConnection {
261262 private watermark = '' ;
262263 private streamUrl : string ;
263264
265+ private pollingInterval : number = 1000 ;
266+
264267 private tokenRefreshSubscription : Subscription ;
265268
266269 constructor ( options : DirectLineOptions ) {
@@ -271,6 +274,9 @@ export class DirectLine implements IBotConnection {
271274 if ( options . webSocket !== undefined )
272275 this . webSocket = options . webSocket ;
273276
277+ if ( options . pollingInterval !== undefined )
278+ this . pollingInterval = options . pollingInterval ;
279+
274280 this . activity$ = this . webSocket && typeof WebSocket !== 'undefined' && WebSocket
275281 ? this . webSocketActivity$ ( )
276282 : this . pollingGetActivity$ ( ) ;
@@ -481,7 +487,7 @@ export class DirectLine implements IBotConnection {
481487 }
482488
483489 private pollingGetActivity$ ( ) {
484- return Observable . interval ( 1000 )
490+ return Observable . interval ( this . pollingInterval )
485491 . combineLatest ( this . checkConnection ( ) )
486492 . flatMap ( _ =>
487493 Observable . ajax ( {
You can’t perform that action at this time.
0 commit comments