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

[Help Wanted] Connection Handshake

kyranet opened this issue · comments

commented

Describe the proposal

Currently, Veza resolves Node#connectTo way early:

Process A:

  • NodeSocket Calls Socket#connect.
  • Socket emits private connect, resolving the internal promise.
  • NodeSocket emits client.ready.
  • Node#connectTo resolves.

Process B:

  • NodeServer receives connection, creating a NodeServerClient.
  • NodeServerClient listens to all internal events, sends Identify packet.
  • NodeServerClient receives Process A's NodeSocket's name as a response for Identify.
  • NodeServerClient emits client.identify.

The ideal way is, Node#connectTo should send the Identify packet, not the NodeServerClient, so both ends have their respective names.

This would also remove the parameter name from Node#connectTo, as it will be retrieved from the handshake.

I'm studying/searching for ways to implement this.

Yeah im still doing this, just trying to find my way thru the spaghetti