Azure / azure-webpubsub

Azure Web PubSub Service helps you to manage WebSocket connections and do publish and subscribe in an easy way
https://azure.github.io/azure-webpubsub/
MIT License
135 stars 85 forks source link

Passing connection option to event handler #486

Open Cytranics opened 1 year ago

Cytranics commented 1 year ago

Describe the bug

Not sure if this is a bug or not, but after 5 days, 10 hours a day i feel compelled to post this. The connect function to send to event handler does not seem to work at all with any examples. I constantly get a "Request server is denied as target server is invalid."

I've gone through the entire server sdk and I cant see where the handshake is failing.

In additional it never seems to pass CORS. Copy and pasting example does not work. Implementing CORS properly doesnt work.

To Reproduce

Copy and past chat code, dev code, all samples of handling connect option into a new pub sub.

We will close this issue if:

Exceptions (if any)

Further technical details

-javascript, repo is above

vicancy commented 1 year ago

Hi @Cytranics , have you configured the event handler settings? What tunnel tool are you using to expose your localhost to public?

Cytranics commented 1 year ago

Hi @Cytranics , have you configured the event handler settings? What tunnel tool are you using to expose your localhost to public?

Not for the connect. I have an azure web app so no tunnel, using node.js... I copy and paste your exact example and it does not authenticate. I have a feeling it wasnt passing the correct headers to authenticate via the Webhook Orgin. With that said, I really didnt need a connect handshake in the end, and ended up just using connected event.

vicancy commented 1 year ago

I copy and paste your exact example and it does not authenticate.

How did you setup the event handlers in your portal? The sample does not need to configure connect so the event handler code does not handle the connect event (handleEvent), so if you configured connect event in your portal it actually fails because no upstream handles the event.

nidri commented 6 months ago

Facing the same issue. Event handler is not being called. When checked in Live Trace Tool, it always shows the Abuse protection and Connection Exception. The outbound traffic from Web PubSub service is restricted by default I guess. Not sure how to enable it, although enabled full network access.

image

image

vicancy commented 6 months ago

Facing the same issue. Event handler is not being called. When checked in Live Trace Tool, it always shows the Abuse protection and Connection Exception. The outbound traffic from Web PubSub service is restricted by default I guess. Not sure how to enable it, although enabled full network access.

image

image

Have you configured any authenticate middleware in your app server? Is your app server accessible if you curl https://<your_web_app_host>/<your_eventhandler_path_as_configured> -X OPTIONS -H "WebHook-Request-Origin: *" -H "ce-awpsversion: 1.0" --ssl-no-revoke -i?

nidri commented 6 months ago

Facing the same issue. Event handler is not being called. When checked in Live Trace Tool, it always shows the Abuse protection and Connection Exception. The outbound traffic from Web PubSub service is restricted by default I guess. Not sure how to enable it, although enabled full network access. image image

Have you configured any authenticate middleware in your app server? Is your app server accessible if you curl https://<your_web_app_host>/<your_eventhandler_path_as_configured> -X OPTIONS -H "WebHook-Request-Origin: *" -H "ce-awpsversion: 1.0" --ssl-no-revoke -i?

We suspect it could be a firewall thing. We changed to a different publicly available URL and the events were being sent. It is something with our original URL we have to deal with .

Thanks for your insights @vicancy