Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getServerTransport(protocol: string, options: ServerOptions) {
switch (protocol) {
case 'tcp':
default:
return new RSocketTCPServer({...options});
case 'ws':
return new RSocketWebSocketServer({...options});
}
}
constructor(opts: GatewayOptions) {
const { port } = opts;
this.port = port || 3000;
this.transport = new RSocketWebSocketServer({ port: this.port });
const { requestResponse: optRequestResponse, requestStream: optRequestStream } = opts;
validateCustomHandlers('requestResponse', optRequestResponse);
validateCustomHandlers('requestStream', optRequestStream);
this.requestResponse = optRequestResponse;
this.requestStream = optRequestStream;
}
function getTransport(protocol: string, options: ServerOptions) {
switch (protocol) {
case 'tcp':
return new RSocketTCPServer({...options});
case 'ws':
default:
return new RSocketWebSocketServer({...options});
}
}
}
},
error => subscriber.onError(error),
() => subscriber.onComplete()
);
}
updates++;
}
});
});
}
};
},
serializers: JsonSerializers,
transport: new RSocketWebSocketServer(serverConfig)
});
this._server.start();
} catch(error) {
reject(errors.cantStartServer)
}
return resolve();
})
subscriber.onComplete();
}
} else {
subscriber.onNext({ data: getTextResponseMany(index++)(data) });
}
}, 100);
}
}
}
});
});
}
};
},
serializers: JsonSerializers,
transport: new RSocketWebSocketServer({
protocol: 'ws',
host: '0.0.0.0',
port: 8080
})
});
export const startServer = () => server.start();
export const stopServer = () => server.stop();