How to get current path in on_mount hook?

Have you tried socket.private.connect_info.request_path?

Also, here’s a recent related post: