Preventing Safari background tabs disconnecting from server
I think the setting you’re looking for is Disable Hidden Page Timer Throttling, located under Debug → Miscellaneous Flags.

If you haven’t enabled the Safari Debug menu yet, triple-click the following line and paste it into a Terminal session:
defaults write com.apple.Safari IncludeInternalDebugMenu 1

Now completely quit Safari, then reopen it. The Debug menu should become available.

If you’re on Safari Technology Preview, the Terminal command is:
defaults write com.apple.SafariTechnologyPreview IncludeInternalDebugMenu 1