diff --git a/test/test.ts b/test/test.ts index e409528..d77e155 100644 --- a/test/test.ts +++ b/test/test.ts @@ -33,7 +33,7 @@ tap.test('should add some handlers', async () => { tap.test('should create Server and Client', async (tools) => { 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 () => { diff --git a/ts/typedsocket.classes.typedsocket.ts b/ts/typedsocket.classes.typedsocket.ts index 7f495fb..4890262 100644 --- a/ts/typedsocket.classes.typedsocket.ts +++ b/ts/typedsocket.classes.typedsocket.ts @@ -71,15 +71,16 @@ export class TypedSocket { ): Promise { const domain = new plugins.smartstring.Domain(serverUrlArg); - - const smartsocketClient = new plugins.smartsocket.SmartsocketClient({ + const socketOptions = { alias: aliasArg, role: publicRoleName, password: publicRolePass, port: domain.port || 3000, - url: `${domain.nodeParsedUrl.protocol}//${domain.nodeParsedUrl.host}`, + url: `${domain.nodeParsedUrl.protocol}//${domain.nodeParsedUrl.hostname}`, autoReconnect: true, - }); + } + console.log(socketOptions); + const smartsocketClient = new plugins.smartsocket.SmartsocketClient(socketOptions); smartsocketClient.addSocketFunction( new plugins.smartsocket.SocketFunction({ funcName: 'processMessage',