I hosted a simple Go websocket service in port 3000, and used postman with ws://Droplet-IPV4:port/ws but when I try to connect to the same with a simple app I built on my system using python-websocket, it’s giving me this error -> Error occurred: [Errno 61] Connection refused. Please let me know if there’s a way I can connect to my server
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Enter your email to get $200 in credit for your first 60 days with DigitalOcean.
New accounts only. By submitting your email you agree to our Privacy Policy.
Hi there,
As you are able to connect with Postman it indicates that the problem is not related to a network problem or a firewall configuration. You are running both Postman and your Python app on the same laptop right?
If this is the case, then it sounds like it might be something to do with your Python app itself, I could suggest testing this out with the following sample app and see if you get the same behaviour:
websocket
library:This script will connect to the WebSocket server at the provided address (
ws://your-server-ip:3000/ws
). When it receives a message, it will print that message. If an error occurs, it will print the error. When the connection is closed, it will print a closed message. If the connection is successfully opened, it will print an opened message.You’ll need to replace
"ws://your-server-ip:3000/ws"
with the address of your WebSocket server.If you are still getting connection refused, here are some general things that you could check:
Check if the service is running: SSH into your droplet and use the
netstat
command to check if your Go service is running and listening on the expected port:This should show you something like this if your service is running and listening:
If you don’t see any output, that means your Go service is not running or not listening on port 3000.
Check firewall rules: If you’re using UFW on your droplet, you can list the firewall rules with this command:
Let me know how it goes!
Best,
Bobby