fix(core): update

This commit is contained in:
Philipp Kunz 2021-01-23 05:14:29 +00:00
parent 479cf60239
commit 53874a7772
2 changed files with 6 additions and 5 deletions

View File

@ -33,7 +33,7 @@ tap.test('should add some handlers', async () => {
tap.test('should create Server and Client', async (tools) => { tap.test('should create Server and Client', async (tools) => {
testTypedSocketServer = await typedsocket.TypedSocket.createServer(testTypedRouter); testTypedSocketServer = await typedsocket.TypedSocket.createServer(testTypedRouter);
testTypedSocketClient = await typedsocket.TypedSocket.createClient(testTypedRouter, 'http://localhost'); testTypedSocketClient = await typedsocket.TypedSocket.createClient(testTypedRouter, 'http://localhost:3000');
}); });
tap.test('should process messages from both sides', async () => { tap.test('should process messages from both sides', async () => {

View File

@ -71,15 +71,16 @@ export class TypedSocket {
): Promise<TypedSocket> { ): Promise<TypedSocket> {
const domain = new plugins.smartstring.Domain(serverUrlArg); const domain = new plugins.smartstring.Domain(serverUrlArg);
const socketOptions = {
const smartsocketClient = new plugins.smartsocket.SmartsocketClient({
alias: aliasArg, alias: aliasArg,
role: publicRoleName, role: publicRoleName,
password: publicRolePass, password: publicRolePass,
port: domain.port || 3000, port: domain.port || 3000,
url: `${domain.nodeParsedUrl.protocol}//${domain.nodeParsedUrl.host}`, url: `${domain.nodeParsedUrl.protocol}//${domain.nodeParsedUrl.hostname}`,
autoReconnect: true, autoReconnect: true,
}); }
console.log(socketOptions);
const smartsocketClient = new plugins.smartsocket.SmartsocketClient(socketOptions);
smartsocketClient.addSocketFunction( smartsocketClient.addSocketFunction(
new plugins.smartsocket.SocketFunction({ new plugins.smartsocket.SocketFunction({
funcName: 'processMessage', funcName: 'processMessage',