我不是一个前端开发人员,并没有使用反应或任何通量实现,因为我不确定他们是否会做我想要的。 我试图围绕如何使用react来呈现客户端外部的后端更改,即由另一个用户进行更改。 我看到当客户端执行操作时,react如何处理视图,但是我想在没有长轮询的情况下从服务器/其他用户呈现更改(类似于meteor如何使用双向数据绑定)。
我的解决方案是在后端创建一个pub / sub系统,如果他们订阅了适当的频道,它将推动对客户的更改。 这可以通过分析数据库查询/后端操作及其产生的更改来完成,就像使用Asana的Luna一样。 我的朋友告诉我,我只需要使用flux的实现就可以做到这一点。 如果他是正确的,我一定是误解了实际上的变化。 对我而言,它似乎只反映了基于“当前”客户行为的变化。
I'm not a frontend developer and have not used react or any flux implementations as I'm not sure if they will do what I want. I'm trying to wrap my head around how to use react to render backend changes that are external to the client, ie changes by another user. I see how react works to handle the view when the client takes an action, but I'd like to render changes from the server/other users without long polling (similar to how meteor works with two-way data binding).
My solution was to create a pub/sub system on the backend that will push changes to the clients if they're subscribed to the appropriate channel. This could be accomplished by analyzing database queries/backend actions and their resulting changes as is done with Asana's Luna. My friend told me that I can simply do this with only using an implementation of flux. If he's correct, I must be misunderstanding what flux actually does. To me, it seemed that it only reflects changes based on the actions of the 'current' client.
最满意答案
你是对的。 Flux只是一种管理应用程序状态以响应不同操作的方法。 如何触发这些行动是出于他们的担忧。 在这种情况下,pub / sub服务器是一种正确的方法。 您可以查看Firebase - 谷歌非关系型数据库,该数据库具有适用于不同平台的大量SDK,并且可以通知客户其他用户所做的更改。 但无论如何它作为一个pub / sub服务器=)
You are right. Flux is simply a way to manage application state in response to different actions. How you would trigger those actions is out of its concern. pub/sub server in this situation is a right way to go. You can take a look at Firebase - google non relational database that has lots of SDKs for different platforms and can notify client of changes done by other users. But anyway it works as a pub/sub server =)
使用react来反映数据层的外部变化(Using react to reflect external changes from the data layer)我不是一个前端开发人员,并没有使用反应或任何通量实现,因为我不确定他们是否会做我想要的。 我试图围绕如何使用react来呈现客户端外部的后端更改,即由另一个用户进行更改。 我看到当客户端执行操作时,react如何处理视图,但是我想在没有长轮询的情况下从服务器/其他用户呈现更改(类似于meteor如何使用双向数据绑定)。
我的解决方案是在后端创建一个pub / sub系统,如果他们订阅了适当的频道,它将推动对客户的更改。 这可以通过分析数据库查询/后端操作及其产生的更改来完成,就像使用Asana的Luna一样。 我的朋友告诉我,我只需要使用flux的实现就可以做到这一点。 如果他是正确的,我一定是误解了实际上的变化。 对我而言,它似乎只反映了基于“当前”客户行为的变化。
I'm not a frontend developer and have not used react or any flux implementations as I'm not sure if they will do what I want. I'm trying to wrap my head around how to use react to render backend changes that are external to the client, ie changes by another user. I see how react works to handle the view when the client takes an action, but I'd like to render changes from the server/other users without long polling (similar to how meteor works with two-way data binding).
My solution was to create a pub/sub system on the backend that will push changes to the clients if they're subscribed to the appropriate channel. This could be accomplished by analyzing database queries/backend actions and their resulting changes as is done with Asana's Luna. My friend told me that I can simply do this with only using an implementation of flux. If he's correct, I must be misunderstanding what flux actually does. To me, it seemed that it only reflects changes based on the actions of the 'current' client.
最满意答案
你是对的。 Flux只是一种管理应用程序状态以响应不同操作的方法。 如何触发这些行动是出于他们的担忧。 在这种情况下,pub / sub服务器是一种正确的方法。 您可以查看Firebase - 谷歌非关系型数据库,该数据库具有适用于不同平台的大量SDK,并且可以通知客户其他用户所做的更改。 但无论如何它作为一个pub / sub服务器=)
You are right. Flux is simply a way to manage application state in response to different actions. How you would trigger those actions is out of its concern. pub/sub server in this situation is a right way to go. You can take a look at Firebase - google non relational database that has lots of SDKs for different platforms and can notify client of changes done by other users. But anyway it works as a pub/sub server =)
发布评论