kyranet / veza

IPC/TCP Networking Utility to connect several processes with great concurrency.

Home Page:https://veza.js.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Disconnect overriden veza nodes

gc opened this issue · comments

commented

Describe the issue

When a new node is created with the same name as an exiting node, it will override that one and start receiving messages, the old one should disconnect as it is now doing nothing.

Code or steps to reproduce

Using the hello.js/world.js example, you can add this to the server (hello.js)

setInterval(() => {
	node.broadcast("ping", { timeout: 5000, receptive: false }).then(console.log).catch(console.error);
}, 3000);

and then, in the client (world.js)

.on('message', (message) => {
	console.log('New message on client');
	console.log(message);
});

next, start the server, and run the world.js file twice

Expected and actual behavior

Further details

  • node.js version:
  • veza version:
  • I have tested the issue on latest master. Commit hash: