Unregister path in socketapi before removing it.