前端和后端应该如何就通知链接(路线)进行交流?
我正在尝试实施一个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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不了解更多,很难理解。但是,如果您有很多不同的路径
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 intosocket.io
and have your server listen for event changes and what to do with them ect.