File tree Expand file tree Collapse file tree 2 files changed +22
-14
lines changed Expand file tree Collapse file tree 2 files changed +22
-14
lines changed Original file line number Diff line number Diff line change @@ -56,19 +56,27 @@ class SIPBaseClient extends SIPBase {
56
56
57
57
_setupConnection ( ws ) {
58
58
var _self = this ;
59
- if ( ws && typeof ( ws ) === 'object' ) {
60
- if ( ws . readyState === ws . OPEN ) {
61
- _self . _initReceivers ( ws ) ;
62
- } else {
63
- ws . addEventListener ( 'open' , function ( ) {
59
+ try {
60
+ if ( ws && typeof ( ws ) === 'object' ) {
61
+ if ( ws . readyState === ws . OPEN ) {
64
62
_self . _initReceivers ( ws ) ;
65
- } ) ;
66
-
67
- ws . addEventListener ( 'close' , ( ) => {
68
- _self . emit ( 'close' ) ;
69
- } ) ;
63
+ } else {
64
+ ws . addEventListener ( 'open' , function ( ) {
65
+ _self . _initReceivers ( ws ) ;
66
+ } ) ;
67
+
68
+ ws . addEventListener ( 'close' , ( ) => {
69
+ _self . emit ( 'close' ) ;
70
+ } ) ;
71
+
72
+ ws . addEventListener ( 'error' , ( error ) => {
73
+ _self . emit ( 'error' , error ) ;
74
+ } ) ;
75
+ }
76
+ _self . _ws = ws ;
70
77
}
71
- _self . _ws = ws ;
78
+ } catch ( error ) {
79
+ _self . emit ( 'error' , error ) ;
72
80
}
73
81
}
74
82
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " mcs-sip-api" ,
3
- "version" : " 0.0.1-dev " ,
3
+ "version" : " 0.0.2 " ,
4
4
"dependencies" : {
5
- "ws" : " 3 .1.0 " ,
6
- "uuid" : " * "
5
+ "ws" : " 6 .1.2 " ,
6
+ "uuid" : " 3.3.2 "
7
7
},
8
8
"devDependencies" : {
9
9
"nodeunit" : " 0.11.1"
You can’t perform that action at this time.
0 commit comments