Yesterday I started work in earnest on the leowapp.py plugin.  The gui work 
is complete for now: the web page contains the outline, body and log panes 
and the minibuffer.

Attempting two-way communication encountered a roadblock.  Putting 
"require(http)" in a client-side script fails with the console message:

    ReferenceError: require is not defined

We can not use a node.js server in the browser, as explained here 
<https://stackoverflow.com/questions/19059580/client-on-node-uncaught-referenceerror-require-is-not-defined>
.

With my new insights about sockets, I saw that the proper question is *not*:

    Can javascript create *servers *in browsers?

but instead:

    Can javascript create *sockets *in browsers?

The answer to this question is an emphatic yes 
<https://stackoverflow.com/questions/1736382/how-to-use-sockets-in-javascript-html>.
 
This leads to WebSockets <https://en.wikipedia.org/wiki/WebSocket>, with 
this tutorial <https://www.html5rocks.com/en/tutorials/websockets/basics/>.

*Summary*

WebSockets is perfect for LeoWapp: high performance, two-way communication, 
supported by all major browsers.  LeoWapp is essential if Leo's browser gui 
is to have the fine granularity I envisaged in the initial design.

web.py <http://webpy.org/> or requests 
<http://docs.python-requests.org/en/master/> might replace the aging, ugly, 
python-side guts of leowapp.py. (The present code barfs on POST requests). 
We shall see. requests is part of the Anaconda distro, web.py is not.

Edward

P. S. Imo, LeoWapp should *require *Python 3. I see no justification 
supporting Python 2 in leading-edge web work.  Comments in the 
documentation for the requests package indicate that there are serious 
problems in attempting to do so.

EKR

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to