前端和后端应该如何就通知链接(路线)进行交流?

发布于 2025-02-07 11:44:53 字数 185 浏览 1 评论 0原文

我正在尝试实施一个React应用程序,并在其中接收实时通知。其中一些通知必须包括链接,即应用程序途径。当用户单击通知时,应将她重定向到特定路线。

我的问题是后端应该如何意识到这些路线?他们应该如何交流?

我能想到的唯一解决方案是对这些通知和路线进行分类,并根据其类别将用户重定向到相应的路线。

还有其他解决方案吗?

I'm trying to implement a react application in which it receives real-time notifications. Some of these notifications must include links, which are routes of application. When the user clicks on a notification, she should be redirected to the specific route.

My question here is how should the backend be aware of these routes? how should they communicate?

The only solution I could think of is to categorize these notifications and routes and, based on their categories, redirect users to the Corresponding routes.

Is there any other solution?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

通知家属抬走 2025-02-14 11:44:53

不了解更多,很难理解。但是,如果您有很多不同的路径React-Router,则您的路线解决方案似乎是必经之路。至于“实时”通知,我会查看socket.io,并让您的服务器侦听事件更改以及如何处理它们。

It's hard to understand without knowing more. but your solution for routes if you have a lot of different paths react-router seems the way to go. As far as "real-time" notifications I would look into socket.io and have your server listen for event changes and what to do with them ect.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文