When each user’s page loads, he or she gets
assigned a random “PeerJS ID”. At least one user
ID must be communicated to the other users (by e-
mail or any other medium). When the other users
receive the ID of this “master user”, they use it to
connect to him/her. Users can then select whether
they transmit rotations, states and JSmol
commands to the master user as they apply them
to their visualizations, and whether they apply to
their visualizations the rotations, states and
commands received from the master user.
Independently, any other pair of users can
additionally connect to each other to send and
receive states and commands directly between
them.
Within the web app, users can also chat and
send files to each other. And although not
implemented in this web app, the communication
technology employed also allows the
incorporation of video and audio conferencing.
Brief technicalities about the implementation
This web app is self-contained in a single
HTML file. It uses web sockets (here through the
Peer.js library, but others could be used) and a
plugin-less molecular viewer for browsers (here
JSmol, but also other scriptable viewers could be
used). Through HTML and JavaScript code, the
web app controls when it sends rotations and
commands applied by one peer to the other peers,
and whether the rotations and commands received
from another user are applied.
The current implementation runs only over
http, but web socket libraries that handle https
could be used to allow https access (which would
enable JSmol to directly load structures directly
from the Protein Data Bank, instead of the user
having to download it first as in the current
version of the web app).
A last important point is that the web app, as
provided in its single HTML file, can be directly
copied to any other webserver retaining
functionality (a copy of JSmol and proper
reference to it must be given).
Perspectives
Being this web app only a prototype to show
feasibility, there are multiple modifications and
additions worth exploring. For example, it could
be useful to transmit not only commands typed for
the JSmol applet but also any other command
applied directly from the JSmol interface or
console. Also, additional commands prebuilt into
buttons could be implemented, depending on the
intended uses (small molecules or biological
molecules or materials, for research or didactic,
etc.)
This example web app shall promote the
development of interfaces for concurrent work in
other disciplines. Not only for molecular sciences
but for virtually any discipline where transmitting
small pieces of data to transform views on other
users’ devices can help to better communicate
ideas and concepts at a distance.
References
(1) Abriata, L. A. Informatics 2017, 4 (3).
(2) Abriata, L. A.; Rodrigues, J. P. G. L. M.;
Salathé, M.; Patiny, L. Trends Biotechnol.
2017.
(3) Hanson, R. M.; Prilusky, J.; Renjian, Z.;
Nakane, T.; Sussman, J. L. Isr. J. Chem.
2013, 53 (3–4), 207–216.
(4) Bu, M.; Zhang, E. Peer.js.