Socket setup with proper URL routing