@solidjs/router for routing, here's the code:Guard component checks for authentication (whether key is not in localStorage) in createEffect and navigates based on the result. The Root component is a protected component and only authenticated user can access it (localStorage contains the key item).Root component looks something like this:WebSocket is connected before the Guard component validates and navigates the user.