One way to identify local vs server could be checking the url pattern session$clientData$url_hostname
Another way (that I use for sql connections) could be checking the OS with a function, but this is not as generalizable as the previous one.
get_os <- function(){
sysinf <- Sys.info()
os <- sysinf['sysname']
if (os == 'Darwin'){
os <- "osx"
} else { ## mystery machine
os <- .Platform$OS.type
if (grepl("^darwin", R.version$os))
os <- "osx"
if (grepl("linux-gnu", R.version$os))
os <- "linux"
if (grepl("linux-gnueabihf", R.version$os))
os <- "raspbian"
}
tolower(os)
}