How to Get Websocket to Work on Jellyfin

The location must by socket rather han embywebsocket

server {
  listen 80;
  listen [::]:80;
  server_name www.sub.domain.com sub.domain.com;
  return 301 https://sub.domain.com$request_uri;
}
server {
  listen 443 ssl http2;
  listen [::]:443 ssl http2;
  server_name sub.domain.com; 

  ssl_session_timeout 30m;
  ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
  ssl_certificate      /usr/local/nginx/ssl/cert.pem;
  ssl_certificate_key  /usr/local/nginx/ssl/privkey.pem;

  add_header X-Xss-Protection "1; mode=block" always;
  add_header X-Content-Type-Options "nosniff" always;
  add_header Strict-Transport-Security "max-age=2592000; includeSubdomains" always;
  add_header X-Frame-Options "SAMEORIGIN" always;
  proxy_hide_header X-Powered-By;
  add_header 'Referrer-Policy' 'no-referrer';
  add_header Content-Security-Policy "frame-ancestors domain.com sub.domain.com;";

  location / {
    proxy_pass http://localhost:8096;  
    proxy_set_header Range $http_range;
    proxy_set_header If-Range $http_if_range;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }
  location /socket {
    proxy_pass http://localhost:8096;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-Protocol $scheme;
    proxy_set_header X-Forwarded-Host $http_host;
   }
}