Gero
Gero

Reputation: 13563

Web UI bind html element with observeable variable in server-side code

Is it possible to data-bind a html field (2way binding or 1way binding) to a observeable variable that is declered in some server-side code?

Would be awesome if you could change the value of one variable on the server-side and all clients get updated that one specific html field.

Upvotes: 2

Views: 143

Answers (1)

Kai Sellgren
Kai Sellgren

Reputation: 30312

There's no built-in way to do this as it involves dealing with a bunch of things like networking and serialization.

I am building an application where the server side framework sends data notifications to all clients via WebSockets. The data is automatically serialized/deserialized so that my views can listen to a stream of data notifications and act on them.

So, in essence, when data is modified on the server either automatically or by request of a client, the changes are propagated to every client in real-time. However, the clients decide if they are interested in the data notification and only so they will retrieve the updated information.

Give it a shot and try to write something and come back with any specific problems you might face.

Upvotes: 2

Related Questions