I implemented an custom authorisation on the Rest subscribe endpoint, which throws an exception if no valid key is passed. This works fine in a happy flow, but I ran across the issue that when the auth key is invalid and the exception is thrown, the component still triggers the ConnectionOpened event, even though the connection is not open. This causes no messages to be passed. The TokenReceived event is not triggered.
I checked in the JavaScript source, and found that the connection request is not validated (MsftFetchEventSource.js line 58)
If the response is validated, the events do work as expected.
Can be reproduced by setting the authentication method on the Subscribe endpoint to custom, and throwing an exception there.
Hi Roel Janssen,
Thanks for the detailed share. I will release a patch soon with a guard to validate the existence of the response object.
Thanks,