Move ws, home declarations outside handler

Move ws, home declarations outside handler to avoid runtime dependencies. If there is an issue with either of these it then gets flagged on server start instead of waiting until the route gets called.