|
1 | | -import { |
2 | | - CONNECTION_CLOSED_CODE_MICROPHONE_PERMISSION_DENIED, |
3 | | - CONNECTION_CLOSED_CODE_NORMAL, |
4 | | - CONNECTION_CLOSED_CODE_WEBRTC_FAILURE, |
5 | | -} from '../lib/constants'; |
| 1 | +import { ConnectionClosedCode } from '../lib/constants'; |
6 | 2 | import { |
7 | 3 | EngineApiRestClient, |
8 | 4 | InternalEventEmitter, |
@@ -353,7 +349,8 @@ export class StreamingClient { |
353 | 349 | console.log('StreamingClient - onSignalMessage: reason', reason); |
354 | 350 | this.publicEventEmitter.emit( |
355 | 351 | AnamEvent.CONNECTION_CLOSED, |
356 | | - CONNECTION_CLOSED_CODE_NORMAL, |
| 352 | + ConnectionClosedCode.SERVER_CLOSED_CONNECTION, |
| 353 | + reason, |
357 | 354 | ); |
358 | 355 | // close the peer connection |
359 | 356 | this.shutdown(); |
@@ -440,12 +437,12 @@ export class StreamingClient { |
440 | 437 | if (err.name === 'NotAllowedError' && err.message === 'Permission denied') { |
441 | 438 | this.publicEventEmitter.emit( |
442 | 439 | AnamEvent.CONNECTION_CLOSED, |
443 | | - CONNECTION_CLOSED_CODE_MICROPHONE_PERMISSION_DENIED, |
| 440 | + ConnectionClosedCode.MICROPHONE_PERMISSION_DENIED, |
444 | 441 | ); |
445 | 442 | } else { |
446 | 443 | this.publicEventEmitter.emit( |
447 | 444 | AnamEvent.CONNECTION_CLOSED, |
448 | | - CONNECTION_CLOSED_CODE_WEBRTC_FAILURE, |
| 445 | + ConnectionClosedCode.WEBRTC_FAILURE, |
449 | 446 | ); |
450 | 447 | } |
451 | 448 |
|
|
0 commit comments