Make {web}socket more robust