I'm not able to create the "Advanced Interface" of nativescript-websocket in Angular/Typescript, I need it to use a custom sslFactory to trust all certs.
The problem is that nothing happens and I can't see any error messagge when I'm trying to connect to the server. The server is alive and responsive and I can communicate with it using the "Browser based Interface"
constructor(private zone: NgZone,
private _http: HttpWrapperService) {
var WS = require('nativescript-websockets');
this.mySocket = new WS(AppGlobals.WS_HINT_ADDRESS,{
protocols:[AppGlobals.WS_HINT_PROTOCOL],
timeout: 6000, allowCellular: true,
sslSocketFactory: this._http.sslSocketFactory
});
this.mySocket.on('open', function(socket) {
this.zone.run(() => {
console.log("---------Hey I'm open");
});
});
this.mySocket.on('message', function(socket, message) {
this.zone.run(() => {
console.log("---------Got a message", message);
});
});
this.mySocket.on('close', function(socket, code, reason) {
this.zone.run(() => {
console.log("---------Socket was closed because: ", reason, " code: ", code);
});
});
this.mySocket.on('error', function(socket, error) {
this.zone.run(() => {
console.log("---------Socket had an error", error);
});
});
}