Refactor initSocket to accept socket_url, user_id and allowed_devices  data