Question:
Whether I use package ‘websocket’ or ‘ws’, I can’t connect to my simple server on the Internet from PC.
my server:
and my client(dot net: using System.Net.WebSockets):
In fact, I created a nodejs script in replit as a client and executed it with a shell, but the connection still failed. It seems that I have some questions in replit and not c#
ok, use the port :443 like wss://nt.userthx.repl.co:443 or don’t use a port like wss://nt.userthx.repl.co
I also made a WebSocket client in JavaScript too. I was able to connect to my WebSocket server repl without using a port and also using the port 443.
I don’t have experience with WebSocket in C# since I code in JavaScript. Sorry for not being helpful if this doesn’t work. I’m bad at explaining things.
So grateful,and so funny
I didn’t think at all to try it without ports
but it really dont need a port to link
I was tormented by it
replit should tell every rookie like me this info.
but it worked in node.js client ,and not working on my computer with c#
When I remove it as you suggested,i got an error: ’ TypeError: One and only one of the “port”, “server”, or “noServer” options must be specified’
there must be one parameter at least…
and another error is : ‘TypeError: wss.listen is not a function’
it means that the method you gave me doesn’t seem to exist…Do you know which ‘ws’ I’m using
maybe i I did it wrong somewhere. I’m just getting started with node.js in replit
You don’t need to do a DNS lookup for the repl’s IP (just use the hostname for the websocket URL), and you should be using wss://, not ws://. Are you following some kind of tutorial? If so, you might want to find a different tutorial.
That’s funny … it seems that listen any port will do on the server.
Just don’t use the port on the client and use ’wws’.
It’s not just 80 or 443, others are also ok.
Why!
you are right
I should use the domain name, not the IP and should not use the port.In fact, it doesn’t matter which port the server listens on, all be ok that I try several casually. I didn’t read the tutorial, so my writing was very irregular. I just don’t understand why you all know that 443 is the default, but I got the official documents are written in 5900 and 8099. But it doesn’t matter, it seems that any port is unnecessary, it can be used.ffffuny.