Azure / static-web-apps

Azure Static Web Apps. For bugs and feature requests, please create an issue in this repo. For community discussions, latest updates, kindly refer to the Discussions Tab. To know what's new in Static Web Apps, visit https://aka.ms/swa/ThisMonth
https://aka.ms/swa
MIT License
318 stars 53 forks source link

WebSocket Connection Failed. #1505

Open rocalex opened 3 days ago

rocalex commented 3 days ago

I'm trying to connect websocket api. The frontend is Next.js and it's on Azure static web app And the backend is Django, it's on Azure app service. I enabled CORS in the backend, so frontend in localhost has no problem when I connect websocket api of backend (it's on Azure App Service.). I can't find any reason or message on the browser console why connection is failed.

WebSocket connection to 'wss://assessmate.azurewebsites.net/ws/notify/' failed: 
_app-456513e57728c64c.js:149 WebSocket error: 
Event {isTrusted: true, type: 'error', target: WebSocket, currentTarget: WebSocket, eventPhase: 2, …}
  isTrusted: true
  bubbles: false
  cancelBubble: false
  cancelable: false
  composed: false
  currentTarget: WebSocket {url: 'wss://assessmate.azurewebsites.net/ws/notify/?toke… 
  I6MX0.zgUVAmgIStnz7iIj8OXyIhPIK4QqvFbyvPNsjhal86A', readyState: 3, bufferedAmount: 0, onopen: ƒ, onerror: ƒ, …}
  defaultPrevented: false
  eventPhase: 0
  returnValue: true
  srcElement: WebSocket {url: 'wss://assessmate.azurewebsites.net/ws/notify/?toke… 
  I6MX0.zgUVAmgIStnz7iIj8OXyIhPIK4QqvFbyvPNsjhal86A', readyState: 3, bufferedAmount: 0, onopen: ƒ, onerror: ƒ, …}
  target: WebSocket {url: 'wss://assessmate.azurewebsites.net/ws/notify/?toke…I6MX0.zgUVAmgIStnz7iIj8OXyIhPIK4QqvFbyvPNsjhal86A', 
  readyState: 3, bufferedAmount: 0, onopen: ƒ, onerror: ƒ, …}
  timeStamp: 11759.199999999255
  type: "error"
  [[Prototype]]: Event

Please help us!