Sign in
Log inSign up
Tobbe Lundberg

436 reads

4 comments

Nick F
Nick F
Apr 4, 2023

Great article, thank you. But how is it possible to define backend url for WebSocket object? You hardcode it here, but not clear, how to define it on frontend dynamically.

·
·1 reply
Tobbe Lundberg
Tobbe Lundberg
Author
·Apr 5, 2023

For my experiment I didn't bother figuring that out. But when I deployed my example app I did change it to wss://app-url.com/.redwood/functions/ws to get around CORS limitations (where .redwood/functions/ is proxied to my api side by my hosting setup, just like all graphql requests are proxied)

1
·
Nick F
Nick F
Apr 5, 2023

Thanks for the answer. Another question, do you know why wss doesn't pass authentification token into backend handler, so we can't authentificate the request?

·
·1 reply
Tobbe Lundberg
Tobbe Lundberg
Author
·Apr 6, 2023

I don't think WebSockets does that. Have a look at this StackOverflow question and read the answer and the comments on the first question stackoverflow.com/questions/4361173/http-h…

1
·