File tree 3 files changed +21
-3
lines changed
3 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -216,6 +216,7 @@ Options that define **Custom error handlers:**
216
216
- when a protocol violation is occured,
217
217
- when no ` onchallenge ` defined, but a challenge request is received due to authenticate the client,
218
218
219
+
219
220
``` javascript
220
221
var connection = new autobahn.Connection ({
221
222
on_user_error : function (error , customErrorMessage ) {
@@ -240,7 +241,13 @@ Options that define **Custom error handlers:**
240
241
> In a case of error handling in the Callee role, when the invocation handler is executed, the error
241
242
> is reported on the Callee side (with the custom error handler or an error log), but despite that the
242
243
> error is sent back to the Dealer, and the Caller will receive a ` runtime.error ` wamp message.
243
-
244
+
245
+
246
+ Options that control ** tls connection** :
247
+ - ` tlsConfiguration ` : * object*
248
+ - ` ca ` : * Buffer | String* - CA
249
+ - ` cert ` : * Buffer | String* - Certificate Public Key
250
+ - ` key ` : * Buffer | String* - Certificate Private Key
244
251
245
252
Connection Properties
246
253
---------------------
Original file line number Diff line number Diff line change @@ -73,7 +73,8 @@ var Connection = function (options) {
73
73
self . _options . transports = [
74
74
{
75
75
type : 'websocket' ,
76
- url : self . _options . url
76
+ url : self . _options . url ,
77
+ tlsConfiguration : self . _options . tlsConfiguration
77
78
}
78
79
] ;
79
80
}
Original file line number Diff line number Diff line change @@ -97,7 +97,17 @@ Factory.prototype.create = function () {
97
97
protocols = protocols . join ( ',' ) ;
98
98
}
99
99
options . protocol = protocols ;
100
- }
100
+ }
101
+
102
+ if ( self . _options . url . startsWith ( 'wss://' ) ) {
103
+ // Using TLS
104
+ // Only using the known working flags in the options.
105
+ // https://nodejs.org/api/https.html#https_https_request_options_callback
106
+ options . ca = self . _options . tlsConfiguration . ca ;
107
+ options . cert = self . _options . tlsConfiguration . cert ;
108
+ options . key = self . _options . tlsConfiguration . key ;
109
+ options . rejectUnauthorized = false ;
110
+ }
101
111
102
112
websocket = new WebSocket ( self . _options . url , protocols , options ) ;
103
113
You can’t perform that action at this time.
0 commit comments