How to config websocket

My nginx config:

   location ~*/ws/.* {
       proxy_pass http://bredata:8081
       proxy_http_version 1.1;
       proxy_set_header Upgrade $http_upgrade;
       proxy_set_header Connection "upgade";
}

my traefik config:

backend:
    container_name: backend
    restart: always
    labels:
      - traefik.enable=true
      - traefik.http.services.backend.loadbalancer.server.port=8080
      - traefik.http.routers.backend.rule=Host(`${backend:-localhost}`) &&
          PathPrefix(`/api/`)
      - traefik.http.routers.backend.entrypoints=web
    networks:
      - backend

How can i config my websocket proxy service ? thx