Skip to content

Commit 3f519c0

Browse files
ckkashyapcompulim
authored andcommitted
Watermark support for websocket (#96)
* Watermark must be forwarded to the server even in the case of websocket since the server now honors it. * Coding style update * Update CHANGELOG.md
1 parent d6bce8c commit 3f519c0

2 files changed

Lines changed: 15 additions & 9 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
### Added
9+
- Add support for watermark in Web Socket, in [#96](https://github.com/Microsoft/BotFramework-DirectLineJS/pull/96)
810

911
## [0.9.17] - 2018-08-31
1012
### Changed

src/directLine.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -316,25 +316,29 @@ export class DirectLine implements IBotConnection {
316316
this.token = options.secret || options.token;
317317
this.webSocket = (options.webSocket === undefined ? true : options.webSocket) && typeof WebSocket !== 'undefined' && WebSocket !== undefined;
318318

319-
if (options.domain)
319+
if (options.domain) {
320320
this.domain = options.domain;
321+
}
322+
321323
if (options.conversationId) {
322324
this.conversationId = options.conversationId;
323325
}
326+
324327
if (options.watermark) {
325-
if (this.webSocket)
326-
console.warn("Watermark was ignored: it is not supported using websockets at the moment");
327-
else
328-
this.watermark = options.watermark;
328+
this.watermark = options.watermark;
329329
}
330+
330331
if (options.streamUrl) {
331-
if (options.token && options.conversationId)
332+
if (options.token && options.conversationId) {
332333
this.streamUrl = options.streamUrl;
333-
else
334-
console.warn("streamUrl was ignored: you need to provide a token and a conversationid");
334+
} else {
335+
console.warn('streamUrl was ignored: you need to provide a token and a conversationid');
336+
}
335337
}
336-
if (options.pollingInterval !== undefined)
338+
339+
if (options.pollingInterval !== undefined) {
337340
this.pollingInterval = options.pollingInterval;
341+
}
338342

339343
this.activity$ = (this.webSocket
340344
? this.webSocketActivity$()

0 commit comments

Comments
 (0)