I am trying to understand how to handle tcp connection with cluster in nodejs. How does the master know to which child the connection should be routed. Do we need to handle this case or does node handles by itself?
Node handles it internally.
Currently the default algorithm is round robin on all non-Windows platforms. The other method merely consists of just passing the socket to the OS for it to choose which child process to send it to. This is described in the cluster
documentation.