All autossh does is try to keep open/restart an ssh connection as a daemon — I’m not sure there’s any benefit to it these days than just using a systemd service.
That being said, as an example `ssh user@host.com -R 8181:localhost:8080` will open port 8181 on the remote machine you’re connecting to, and forward traffic that’s addressed there to port 8181 on the machine you’re connecting from. That is, you’ll be able to open a browser to http://host.com:8181 to test something running on your dev machine at port 8080. Traffic gets forwarded along the ssh tunnel.
Autossh (or a systemd service supervising an `ssh` connection) will keep that tunnel open.
-M sets the control port for autossh which it uses to check if all is working right. The rest is standard SSH syntax; in this example, a loopback socket on port 8080 on host will get opened, and all requests to it are forwarded to localhost's port 80.
If you want it to be a "real" socket instead of just loopback, set "GatewayPorts clientspecified" in sshd_config.
The main purpose of services like Tunnelmole and ngrok is to basically provide this functionality and save you from having to run your own server. Its easy for people like us, I've used SSH for more than 20 years. Alot of devs however don't have good Linux/infra/ssh exposure. Others might have that exposure, but don't have the spare time or energy to run their own server.