WebSocket connection to notification URL fails
I am following this guide on how to get a Websocket endpoint for my onedrive https://learn.microsoft.com/en-us/graph/api/subscriptions-socketio?view=graph-rest-1.0&tabs=http
I get a fine notification Url back from /subscribtions/socketIo endpoint that looks something like this:
'wss://westeurope0-0.pushnp.svc.ms/notifications?token=TOKEN&applicationId=APP_ID'
(Removed token and appId in this post)
But the when I instantiate a new Websocket with the notification Url it fails with the error message:
'WebSocket connection to (NOTIFICATION_URL) failed: Connection closed before receiving a handshake response'
This the code I use:
const response = await fetch(
`${OneDriveConnection.graphUrl}/drive/root/subscriptions/socketIo`,
{
headers: {
Authorization: "Bearer " + MY_ACCESS_TOKEN,
},
},
);
const data = await response.json();
const wsConnection = new WebSocket(data.notificationUrl);
What could be the issue here?