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 @@ -222,7 +222,8 @@ export interface DirectLineOptions {
222222 secret ?: string ,
223223 token ?: string
224224 domain ?: string ,
225- webSocket ?: boolean
225+ webSocket ?: boolean ,
226+ pollingInterval ?: number
226227}
227228
228229const lifetimeRefreshToken = 30 * 60 * 1000 ;
@@ -262,6 +263,8 @@ export class DirectLine implements IBotConnection {
262263 private watermark = '' ;
263264 private streamUrl : string ;
264265
266+ private pollingInterval : number = 1000 ;
267+
265268 private tokenRefreshSubscription : Subscription ;
266269
267270 constructor ( options : DirectLineOptions ) {
@@ -272,6 +275,9 @@ export class DirectLine implements IBotConnection {
272275 if ( options . webSocket !== undefined )
273276 this . webSocket = options . webSocket ;
274277
278+ if ( options . pollingInterval !== undefined )
279+ this . pollingInterval = options . pollingInterval ;
280+
275281 this . activity$ = this . webSocket && typeof WebSocket !== 'undefined' && WebSocket
276282 ? this . webSocketActivity$ ( )
277283 : this . pollingGetActivity$ ( ) ;
@@ -487,7 +493,7 @@ export class DirectLine implements IBotConnection {
487493 }
488494
489495 private pollingGetActivity$ ( ) {
490- return Observable . interval ( 1000 )
496+ return Observable . interval ( this . pollingInterval )
491497 . combineLatest ( this . checkConnection ( ) )
492498 . flatMap ( _ =>
493499 Observable . ajax ( {
You can’t perform that action at this time.
0 commit comments