|
1 | 1 | --- |
2 | 2 | title: Remote Access |
3 | | -description: Access your Streamer.bot instance remotely over a secure tunnel |
| 3 | +description: Access your Streamer.bot instance from other devices |
4 | 4 | icon: mdi:cloud |
5 | 5 | --- |
6 | 6 |
|
7 | | -:wip |
| 7 | +When interacting with the Streamer.bot WebSocket Server, you may want to access your instance from other devices, such as your phone or another computer. |
| 8 | + |
| 9 | +Depending on your use case, there are a few different ways to achieve this. |
| 10 | + |
| 11 | +## Local Area Network (LAN) |
| 12 | +You can access your Streamer.bot instance over your local network by simply using the local IP address of the machine running Streamer.bot. |
| 13 | + |
| 14 | +### Configuration |
| 15 | + |
| 16 | +By default, Streamer.bot's WebSocket server only listens to connections from `localhost` (i.e. the same machine). |
| 17 | + |
| 18 | +To allow connections from other devices on your local network, you need to change the `Address` setting in the WebSocket settings. |
| 19 | + |
| 20 | +You can listen to **only** LAN devices by setting `Address` to your LAN IP address, or you can simply listen on all adapters by setting `Address` to `0.0.0.0` |
| 21 | + |
| 22 | +### Example |
| 23 | + |
| 24 | +For example, if you have an HTML/Javascript overlay utilizing the Streamer.bot Client, you would change the `host` property to the local IP address of the machine running Streamer.bot. |
| 25 | + |
| 26 | +```js |
| 27 | +const client = new StreamerbotClient({ |
| 28 | + host: '192.168.1.10' // Replace with your local IP address |
| 29 | +}); |
| 30 | +``` |
| 31 | + |
| 32 | +### Mixed Content Restrictions |
| 33 | + |
| 34 | +If you try to interact with the Streamer.bot WebSocket server via a web page hosted from `https://`, most web browsers will block `ws://` connections to any non-localhost address due to mixed content restrictions. |
| 35 | + |
| 36 | +There are a few ways to get around this: |
| 37 | + |
| 38 | +- :badge{label="Secure" color="success" icon="mdi:lock" size=sm} You can use the other remote access methods below to securely connect via `wss://`{lang=bash} |
| 39 | +- :badge{label="Insecure" color="warning" icon="mdi:alert" size=sm} You can use the `--allow-running-insecure-content`{lang=bash} flag in Chromium based browsers |
| 40 | + - :badge{label="Note" color="info" icon="mdi:information-circle-outline" size=sm} This flag will also work for **OBS Studio** and allow connections from any browser sources or docks, such as [Streamer.bot Chat](/guide/extra-features/chat) |
| 41 | +- :badge{label="Insecure" color="warning" icon="mdi:alert" size=sm} You can host your web page via `http://`{lang=bash} instead of `https://`{lang=bash} |
| 42 | + |
| 43 | +## Virtual Private Network (VPN) |
| 44 | +A VPN allows you to securely connect to your home network from anywhere in the world. |
| 45 | + |
| 46 | +### Tailscale |
| 47 | + |
| 48 | +::read-more{to="https://tailscale.com/kb/1017/install"} |
| 49 | +[Tailscale](https://tailscale.com/kb/1017/install) is a VPN based on WireGuard that makes it easy to securely communicate between your devices. |
| 50 | +:: |
| 51 | + |
| 52 | +::steps{level=4} |
| 53 | + |
| 54 | +#### Install Tailscale |
| 55 | +1. Follow the [installation instructions](https://tailscale.com/kb/1017/install) to install Tailscale on the machine running Streamer.bot and any other devices you want to connect from. |
| 56 | +2. Log in to Tailscale using your preferred authentication method. |
| 57 | +3. Ensure that the devices are connected and can see each other in the Tailscale admin console. |
| 58 | + |
| 59 | +#### Configure Tailscale Serve |
| 60 | + |
| 61 | +:::warning |
| 62 | +**Tailscale Serve** requires HTTPS certificates to be enabled on your tailnet. |
| 63 | +<br> |
| 64 | +You can ensure this option is enabled in your [Tailnet DNS Settings](https://login.tailscale.com/admin/dns) |
| 65 | +::: |
| 66 | + |
| 67 | +To serve your Streamer.bot WebSocket Server to all devices on your tailnet, we can use **Tailscale Serve**. |
| 68 | + |
| 69 | +This will createa secure `wss://` endpoint that you can use to connect to your Streamer.bot instance from any devices on your tailnet. |
| 70 | + |
| 71 | +:::read-more{to=https://tailscale.com/kb/1312/serve} |
| 72 | +Refer to the [Tailscale Serve documentation](https://tailscale.com/kb/1312/serve) for more information. |
| 73 | +::: |
| 74 | + |
| 75 | +**Execute Tailscale Serve via Command Line** |
| 76 | + |
| 77 | +:::note |
| 78 | +Replace `8080` with the port your Streamer.bot WebSocket server is running on. By default, this is `8080` |
| 79 | +::: |
| 80 | + |
| 81 | +```bash [Terminal] |
| 82 | +tailscale serve 8080 |
| 83 | +``` |
| 84 | + |
| 85 | +:br |
| 86 | + |
| 87 | +**Execute Tailscale Serve via Streamer.bot** |
| 88 | + |
| 89 | +Alternatively, we can use the [Run a Program](/api/sub-actions/core/system/run-a-program) sub-action to execute the command directly from Streamer.bot, allowing use of [triggers](/guide/triggers) to start Tailscale Serve when certain events happen. |
| 90 | + |
| 91 | +For example, if you add the [Streamer.bot Started](/api/triggers/core/system/streamerbot-started) trigger to your action, Tailscale Serve will automatically start whenever Streamer.bot starts up! |
| 92 | + |
| 93 | +{width=400} |
| 94 | + |
| 95 | +:br |
| 96 | + |
| 97 | +:::success |
| 98 | +You should see a command line window open, with the URL to access your Streamer.bot WebSocket server via Tailscale Serve. |
| 99 | +::: |
| 100 | + |
| 101 | +#### Connect to Streamer.bot |
| 102 | +You can now connect to your Streamer.bot instance from any device on your tailnet using the URL provided by Tailscale Serve. |
| 103 | + |
| 104 | +:::note |
| 105 | +Because Tailscale Serve uses HTTPS, the port you use to connect will always be `443` and you will need to use `wss://` scheme. |
| 106 | +::: |
| 107 | + |
| 108 | + |
| 109 | +**Examples** |
| 110 | + |
| 111 | +::tabs |
| 112 | + |
| 113 | +:::tabs-item{label="Streamer.bot Client" icon="vscode-icons:file-type-js"} |
| 114 | + |
| 115 | +```js |
| 116 | +const client = new StreamerbotClient({ |
| 117 | + host: 'device.my-tailnet.ts.net', |
| 118 | + port: 443, |
| 119 | + scheme: 'wss' |
| 120 | +}); |
| 121 | +``` |
| 122 | + |
| 123 | +::: |
| 124 | + |
| 125 | +:::tabs-item{label="Streamer.bot Chat" icon="mdi:chat"} |
| 126 | + |
| 127 | +You can use Streamer.bot Chat as a browser dock, or from mobile devices at [`chat.streamer.bot`{color=primary}](https://chat.streamer.bot){target=_blank} |
| 128 | + |
| 129 | +To connect securely via Tailscale Serve: |
| 130 | + |
| 131 | +- Set the `Host` field to your Tailscale Serve hostname (e.g. `device.my-tailnet.ts.net`) |
| 132 | +- Set the `Port` field to `443` |
| 133 | +- Enable the `Secure` toggle |
| 134 | + |
| 135 | +{width=500} |
| 136 | + |
| 137 | +::: |
| 138 | + |
| 139 | +:: |
| 140 | + |
| 141 | +:br |
| 142 | + |
| 143 | +## Secure Tunnel |
| 144 | + |
| 145 | +Tunneling services allow you to expose your local Streamer.bot instance to the internet securely. |
| 146 | + |
| 147 | +### Cloudflare Tunnel |
| 148 | + |
| 149 | +::read-more{to="https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/"} |
| 150 | +[Cloudflare Tunnel](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/) allows you to securely expose your local servers to the internet. |
| 151 | +:: |
| 152 | + |
| 153 | +### ngrok |
| 154 | + |
| 155 | +::read-more{to="https://ngrok.com/"} |
| 156 | +[ngrok](https://ngrok.com/) is a popular tool to expose local servers to the internet. |
| 157 | +:: |
| 158 | + |
| 159 | +### Tailscale Funnel |
| 160 | + |
| 161 | +::read-more{to="https://tailscale.com/kb/1223/funnel"} |
| 162 | +[Tailscale Funnel](https://tailscale.com/kb/1223/funnel) allows you to expose local servers to the internet using Tailscale. |
| 163 | +:: |
0 commit comments