Hacker News new | ask | show | jobs
by ikornaselur 1687 days ago
Hm, strange! I've had it recover from my laptop being asleep for hours at a time. I've seen the last contact message tick up until it suddenly manages to make a connection and spring back to life!

I do just use default settings (just always set up mosh server on my remote servers and forget about it), but is it possible that there's some timeout on the other end you could be experiencing? If for any reason you kill the session on the other side, then of course it doesn't work, but for me it's always magically connected again.

I've used Mosh for multiple years, always loved it, until recently when I started using tmux more. For some reason I had loads of problems with colours and the only solution I could find was to manually build it from source with some flags, or even potentially it was a fork or something like that. Just started SSH-ing again (usually have a stable and fast connection) and if I lose the connection, I'll just re-attach the tmux session anyway.

2 comments

Interesting, maybe there's something up with my config. I also run a default setup but the backend is a macintosh, so that may be related. It would be really nice to have it magically reconnect!

I actually use tmux in combo and don't see any color issues that I notice. I wonder if it's something about the colors in your tmux config?

I run ssh/mosh on a Linux laptop to my Mac desktop all day every day. I suspend the laptop every night, and when I open it in the morning, it immediately reconnects.

I run tmux (locally, nesting another session on the Mac) but I don't think that would make a difference here.

I'm not aware of any special config, but I've been using this setup for several years with no major adjustments.

I wonder if there's an issue with my firewall (little snitch). I'll try disabling that and see if that helps any.
Sounds plausible. You definitely need UDP ports 6000-6010 (?) open incoming to the Mac.
I ended up deleting a few extra rules I found in little snitch, and things seem to be working much better. I guess maybe there was some contention in the multiple rules.
you can auto re-attach the tmux session or create new one with something like this in your bash_alias or bashrc.

# tmux auto attach or create new session [ -z "$TMUX" ] && { tmux attach || exec tmux new-session && exit;}