小编jdb*_*w75的帖子

Lua在Google App Engine上

是否可以将Lua与Google App Engine一起使用?我认识到会有很多Java胶水,但我想在大多数逻辑中使用Lua.

google-app-engine lua

4
推荐指数
1
解决办法
1179
查看次数

在运行 Sophos 的计算机上,为什么我的所有浏览器都无法从我的 Python 应用程序实时接收服务器发送的事件 (sse)?

我的 ASGI 应用程序将事件发送到curl,然后发送到我的手机。然而,即使服务器正在发送事件,并且标头看起来正确,但在连接关闭之前,我的 Windows 计算机上的 Firefox 和 Chrome 都不会收到事件。

无论我将服务器托管在 WSL、Powershell 终端还是单独的 Linux 机器上,都会发生这种情况。

然而,如果我将服务器托管在 repl.it 上,这些相同的浏览器可以正常工作(请分叉并尝试一下)。

我尝试修改 Windows 防火墙设置,但无济于事。

这是应用程序代码:

import asyncio
import datetime


async def app(scope, receive, send):
    headers = [(b"content-type", b"text/html")]
    if scope["path"] == "/":
        body = (
            "<html>"
            "<body>"
            "</body>"
            "<script>"
            "  let eventSource = new EventSource('/sse');"
            "  eventSource.addEventListener('message', (e) => {"
            "    document.body.innerHTML += e.data + '<br>';"
            "  });"
            "</script>"
            "</html>"
        ).encode()

        await send({"type": "http.response.start", "status": 200, "headers": headers})
        await send({"type": "http.response.body", "body": …
Run Code Online (Sandbox Code Playgroud)

python antivirus server-sent-events python-asyncio asgi

3
推荐指数
1
解决办法
858
查看次数