Ask coding questions

← Back to all posts
Can't connect to node js TCP server
h
radians (0)

I am trying to connect to a node js TCP server from another repl, but it is not working (the request just times out)

Comments
hotnewtop
programmeruser (595)

Raw TCP servers don't work on Replit. You should use something like websockets instead.
A more in-depth explanation:
All repls have the same (public) IP. The HTTP Host header is used to distinguish between different domains. TCP does not have an equivalent and therefore can't be used, although I have proposed a system with different ports and subdomains.

programmeruser (595)

@radians read the comment, I gave you an alternative.

radians (0)

@programmeruser What I am trying to do does not make sense with WebSockets, is it possible for me to connect using the URL in the host header