---
title: "Discussion on \"WebSockets in RedwoodJS\" | Hashnode"
description: "Discussion on \"WebSockets in RedwoodJS\". For realtime sync between clients"
url: "https://hashnode.com/posts/websockets-in-redwoodjs/63fa212d74bacee9595f0e3d"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [WebSockets in RedwoodJS](https://tobbe.hashnode.dev/websockets-in-redwoodjs?utm_source=hashnode&utm_medium=feed)

For realtime sync between clients

Feb 25, 2023 · 8 min read · tobbe.hashnode.dev  
Updated Feb 27, 2023  
Read the article

-   [#redwoodjs](https://hashnode.com/tag/redwoodjs)
-   [#websockets](https://hashnode.com/tag/websockets)
-   [#react-context](https://hashnode.com/tag/react-context)

## Written by

[Tobbe Lundberg](https://hashnode.com/@tobbe)

@tobbe

  
[View profile](https://hashnode.com/@tobbe)

Fullstack developer with a focus on the technical frontend

## Responses 2

Markdown supported · ⌘↵ to post

[Nick F](https://hashnode.com/@Gydrocasper)

[Apr 5, 2023](https://hashnode.com/posts/websockets-in-redwoodjs/63fa212d74bacee9595f0e3d/comment/642e067f89c68819f9ba9f50)

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?

[Tobbe Lundberg](https://hashnode.com/@tobbe)

[Apr 6, 2023](https://hashnode.com/posts/websockets-in-redwoodjs/63fa212d74bacee9595f0e3d/comment/642e067f89c68819f9ba9f50#reply-642e605689c68819f9baac14)

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-headers-…](https://stackoverflow.com/questions/4361173/http-headers-in-websockets-client-api)

[Nick F](https://hashnode.com/@Gydrocasper)

[Apr 4, 2023](https://hashnode.com/posts/websockets-in-redwoodjs/63fa212d74bacee9595f0e3d/comment/642c82c6edd9bd0e7701ecf2)

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.

[Tobbe Lundberg](https://hashnode.com/@tobbe)

[Apr 5, 2023](https://hashnode.com/posts/websockets-in-redwoodjs/63fa212d74bacee9595f0e3d/comment/642c82c6edd9bd0e7701ecf2#reply-642d0020480bd310626c106b)

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)
