On Monday, October 29, 2018 at 11:11:17 AM UTC-5, Edward K. Ream wrote:

The next step will be to look at using a javascript client in the browser.
>

On Windows and Mozilla, the browser-based example 
<https://websockets.readthedocs.io/en/stable/intro.html#browser-based-example> 
does work,  provided that I temporarily disabled noscript's security checks 
for file:/// urls <https://noscript.net/faq#qa4_1>.  Without this 
exception, noscript munges the page and the Mozilla debugger console shows:

Content Security Policy: The page’s settings blocked the loading of a 
resource at inline (“script-src”).

When I close the web page, the demo server throws this exception, but 
continues serving:

Traceback (most recent call last):
  File "c:\Anaconda3\lib\site-packages\websockets\server.py", line 152, in 
handler
    yield from self.ws_handler(self, path)
  File "websockets_demo_server.py", line 15, in time
    await websocket.send(now)
  File "c:\Anaconda3\lib\site-packages\websockets\protocol.py", line 361, in 
send
    yield from self.ensure_open()
  File "c:\Anaconda3\lib\site-packages\websockets\protocol.py", line 501, in 
ensure_open
    self.close_code, self.close_reason) from self.transfer_data_exc
websockets.exceptions.ConnectionClosed: WebSocket connection is closed: 
code = 1001 (going away), no reason

This is a bit off-putting, but apparently all is working as it should.

Catching ConnectionClosed changes the noise, but might not be the proper 
solution.

*Summary*

It's troubling to disable security checks, even temporarily. I'm a bit 
surprised that such matters weren't mentioned in the websockets 
documentation <https://websockets.readthedocs.io/en/stable/intro.html>.

I'll contact the author to ask his advice on various matters.

The next step will be to fold the relevant code into leowapp.py.

Edward

-- 
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 [email protected].
To post to this group, send email to [email protected].
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