Repository navigation
Description
I wanted to host a TW cloud server on my computer and access it from another computer, but I didn't find how to.
Firstly, I set the server IP to my local IP address to try to access it from my local network: I don't get any error, but I can't connect the scratch project to the server (I set the same IP:port as the server in the URL), either on a computer on the local network or on the computer hosting the server...
I also tried with my external IP address (as a server IP) and by configuring port forwarding to the local IP address of the computer hosting the server: this time I get the following error:
Traceback (most recent call last):
File "/mnt/0CB604AD0CB604AD/Téléchargements/Scratchattach.py", line 53, in <module>
server = sa.init_cloud_server( server_ip, server_port, length_limit=None, allow_non_numeric=True, whitelisted_projects=None, allow_nonscratch_names=True, blocked_ips=[], sync_players=True, log_var_sets=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jloau/.venv/lib/python3.12/site-packages/scratchattach/eventhandlers/cloud_server.py", line 371, in init_cloud_server
return TwCloudServer(
^^^^^^^^^^^^^^
File "/home/jloau/.venv/lib/python3.12/site-packages/scratchattach/eventhandlers/cloud_server.py", line 202, in __init__
SimpleWebSocketServer.__init__(self, hostname, port=port, websocketclass=websocketclass)
File "/home/jloau/.venv/lib/python3.12/site-packages/SimpleWebSocketServer/SimpleWebSocketServer.py", line 622, in __init__
self.serversocket.bind(hostInfo[0][4])
OSError: [Errno 99] Cannot assign requested address
Exception ignored in: <function BaseEventHandler.__del__ at 0x7df1baed3060>
Traceback (most recent call last):
File "/home/jloau/.venv/lib/python3.12/site-packages/scratchattach/eventhandlers/_base.py", line 74, in __del__
self.stop()
File "/home/jloau/.venv/lib/python3.12/site-packages/scratchattach/eventhandlers/cloud_server.py", line 347, in stop
BaseEventHandler.stop(self, wait_call_threads)
File "/home/jloau/.venv/lib/python3.12/site-packages/scratchattach/eventhandlers/_base.py", line 82, in stop
thread = self._thread
^^^^^^^^^^^^
AttributeError: 'TwCloudServer' object has no attribute '_thread'
So I guess I am doing something wrong... Does hosting a TW cloud server at home and access it from somewhere else possible?
Scratchattach version : 3.0.0b4
Tried OS : Windows 11, Linux Mint 22, Android 7.1.1 (using Pydroid)
Activity
TheCommCraft commentedon Jun 6, 2026
Would you please provide your full code?
JloAu commentedon Jun 6, 2026
Sure:
faretek1 commentedon Jun 6, 2026
This could be wrong, but in some cases, setting the
server_ipto0.0.0.0will have a special effect that disables a firewall (this was the case when I used gorilla/websockets). It is definitely possible to self-host a cloud serverAlso is the other machine on your Local area network? Or are you trying to self host for machines outside of your LAN?
TheCommCraft commentedon Jun 6, 2026
I think the server ip is supposed to decide what clients can connect to your server. To allow your client machine to connect, you would need to set the ip to the address od that machine or to
0.0.0.0(which allows all ips).JloAu commentedon Jun 6, 2026
Okay, I'll try this in few days. So I set the server_ip to 0.0.0.0, and I put the external ip of my server in the TW url?
At first the machines will be on my LAN (for my tests), but next I would self host for machines outside of my LAN
TheCommCraft commentedon Jun 6, 2026
For inside your LAN, you should use the local ip in turbowarp. For outside your LAN, you should use the URI that your port forwarding service provides. The
0.0.0.0is at least the case for sockets and I believe that the convention holds for websockets aswell.JloAu commentedon Jun 8, 2026
It doesn't work for both inside and outside my LAN...
JloAu commentedon Jun 9, 2026
The only thing I've been able to do is:
TheCommCraft commentedon Jun 9, 2026
The problem seems to be that scratchattach does not use a secure web socket
Boss-1s commentedon Jun 9, 2026
I believe I'm having the same problem....
I can't connect to my custom websocket server with turbowarp over localhost and 127.0.0.x, only through opening a new terminal window on the same VSCode Codespace that is running the websocket script
Boss-1s commentedon Jun 9, 2026
TheCommCraft commentedon Jun 9, 2026
You might need to use the address "0.0.0.0" in the server code
JloAu commentedon Jun 11, 2026
Is this fixable or should I use the TW cloud servers instead?
TheCommCraft commentedon Jun 11, 2026
Exactly what is your code and what url do you use for turbowarp? Maybe you are still doing something wrong because it is working for me.
JloAu commentedon Jun 11, 2026
Sure, here is my python code:
And here is the turbowarp link: https://turbowarp.org/1321224718?cloud_host=ws://[my external ip]:9080
I use scratchattach 3.0.0b4
10 remaining items
TheCommCraft commentedon Jun 16, 2026
The problem with your firefox installation is that it doesn't seem to support websockets while chrome behaves as expected. To guarantee better support for the cloud server, we might need to implement ssl/tls for the underlying websocket server.
JloAu commentedon Jun 16, 2026
okay, will this also make the cloud server available outside the LAN?
TheCommCraft commentedon Jun 16, 2026
It might. You would probably still need to forward a port to get it working but that depends on your ISP and network settings.
Boss-1s commentedon Jun 16, 2026
Are you thinking of using a third-party provider
JloAu commentedon Jun 16, 2026
I don't think so... I'd like to try hosting it on an old tablet (I can forward a port). If that doesn't work well enough, I'll give Wispbyte a try...
JloAu commentedon Jun 25, 2026
hello, how is it going?
TheCommCraft commentedon Jun 25, 2026
I am still waiting for @faretek1 to approve the pull request
TheCommCraft commentedon Jun 25, 2026
You can use something like cloudflared to create a tunnel to your cloud server and then just use
wss://<tunnel_domain>as the cloud host. A quick and easy way to temporarily create such a tunnel (if you already have cloudflared installed) is to usecloudflared tunnel --url http://localhost:8080and use the tunnel url that the tool provides.8080should be replaced with the port you are using.TheCommCraft commentedon Jun 25, 2026
There will hopefully soon also be a more detailed explanation in the wiki.
JloAu commentedon Jun 25, 2026
I just tried it, and it works perfectly outside my LAN, even on Firefox. Thank you!
TheCommCraft commentedon Jun 25, 2026
Just remember the quick and easy solution is only temporary. To permanently tunnel, you need to consult the cloudflare documentation.
JloAu commentedon Jun 26, 2026
yeah sure
JloAu commentedon Aug 18, 2026
Hello, I just tried the version 2.2.1, which has
sa.init_ssl_cloud_server(), and I get the following error:Here is my code:
Am I doing something wrong?
TheCommCraft commentedon Aug 18, 2026
You need to provide
certfileandkeyfiletoinit_ssl_cloud_server.