Hi,
this is coming from another language, but maybe is also a solution here. The problem with polling is that is scales poorly and can result either in high load or long delays (it all comes down to your application requirements really). In our case we have a high volume and low latency requirements, so polling isn’t an option.
In one project, we use a Faye server and JS libraries to affect the client state. The server is standalone, so you can just run it as a separate service (i.e. it doesn’t matter much in which language it is really; it is a Ruby application); it provides a basic WebSocket connection with a simple PubSub-protocol on top of it.
A JS library on the client side connects to the websocket, registers for a bunch of channels and waits (e.g. a channel like /user/some-magic-hash for a user-specific channel)
On the server side you can use a fairly straightforward API to push messages to faye to inform the client to do something. Depending on how much effort you put into the client you can more or less push arbitrary JS oder DOM changes from the server side then.
In your example it might be that when the button is pressed, the server pushes an “enable-form-xyz” message to the user’s channel. The client on the second computer, which is connected to the same channel, receives an “enable-form-xyz” and can use some simple JS manipulation to enable form fields. Of course you should always do additional server-side validation in case the second computer enters new data and such.
Isn’t quite as simple to setup but has some scaling advantages and provides fairly instant feedback. The protocol used is called Bayeux and I think there are other implementations, Faye for our purposes is just a very simple standalone service to use here.
Greetings
Dennis
Links:
-----------------------------------------------------
Dennis Bliefernicht • Head of Backend Development
T +49 40 357 3001 62
dennis.bliefernicht@xyrality.com
XYRALITY GmbH • Friedensallee 290 • 22763 Hamburg
www.xyrality.com
Registergericht: Hamburg HRB 115332
Geschäftsführer: Sven Ossenbrüggen
-----------------------------------------------------
From: WebObjects & WOnder Development <webobjects-dev@wocommunity.org> on behalf of "Markus Ruggiero (rucotec)" <webobjects-dev@wocommunity.org>
Reply-To: WebObjects & WOnder Development <webobjects-dev@wocommunity.org>
Date: Thursday, 28.January 2021 at 09:27
To: WebObjects & WOnder Development <webobjects-dev@wocommunity.org>
Subject: [WO-DEV] Communication between 2 different browers (but same application)
I need some conceptual help.
Let’s say you have a browser open to a Wonder app (component based session). Imagine you go to a different computer and open another session (maybe via direct action) to the same application. I want to have a button (or some such) in the first window that when clicked communicates to that second independent window and enables some form fields there. The user then submits data to the application from that second window. The first window registers the submission and continues with the user interaction.
How would you do something like this? Is this possible at all? Possibly the second login could be from a mobile device and the presented browser page does not allow to do more interaction with the application than just enter some data and submit. The first session is required do wait for the data (or a cancel) and can then proceed.
Thanks for any ideas / help
—markus—
Markus Ruggiero
4051 Basel / Switzerland mobile +41 79 508 4701