发布
社区首页 >问答首页 >云函数该怎么使用SSE?

云函数该怎么使用SSE?

提问于 2024-12-08 16:46:09
回答 0关注 1查看 19

按照这个文档的相关说明,我创建了一个python实例,然后将示例中的代码粘贴进去:https://cloud.tencent.com.cn/document/product/583/90617

部署之后,我用curl测试了一下:

代码语言:txt
复制
curl -v -H 'Accept:text/event-stream' https://*************.ap-guangzhou.tencentscf.com/stream
*   Trying 198.18.0.147:443...
* Connected to 1301944331-klbf43hm49.ap-guangzhou.tencentscf.com (198.18.0.147) port 443
* ALPN: curl offers h2,http/1.1
* (304) (OUT), TLS handshake, Client hello (1):
*  CAfile: /etc/ssl/cert.pem
*  CApath: none
* (304) (IN), TLS handshake, Server hello (2):
* (304) (IN), TLS handshake, Unknown (8):
* (304) (IN), TLS handshake, Certificate (11):
* (304) (IN), TLS handshake, CERT verify (15):
* (304) (IN), TLS handshake, Finished (20):
* (304) (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / AEAD-CHACHA20-POLY1305-SHA256
* ALPN: server did not agree on a protocol. Uses default.
* Server certificate:
*  subject: C=CN; ST=Guangdong Province; L=Shenzhen; O=Tencent Technology (Shenzhen) Company Limited; CN=*.tencentscf.com
*  start date: Aug  9 00:00:00 2024 GMT
*  expire date: Aug  8 23:59:59 2025 GMT
*  subjectAltName: host "1301944331-klbf43hm49.ap-guangzhou.tencentscf.com" matched cert's "*.ap-guangzhou.tencentscf.com"
*  issuer: C=US; O=DigiCert, Inc.; CN=DigiCert Secure Site OV G2 TLS CN RSA4096 SHA256 2022 CA1
*  SSL certificate verify ok.
* using HTTP/1.x
> GET /stream HTTP/1.1
> Host: 1301944331-klbf43hm49.ap-guangzhou.tencentscf.com
> User-Agent: curl/8.4.0
> Accept:text/event-stream
> 
< HTTP/1.1 433 status code 433
< Content-Disposition: attachment
< Content-Length: 0
< Content-Type: text/event-stream; charset=utf-8
< Date: Sun, 08 Dec 2024 08:32:33 GMT
< Server: openresty
< Vary: Accept-Encoding
< X-Scf-Message: TimeLimitReached
< X-Scf-Private-Duration: 3000
< X-Scf-Private-Memsize: 18669568
< X-Scf-Private-Wantraffic: 0
< X-Scf-Request-Id: f3dff7ca-b53e-11ef-a20d-52540043ea0b
< X-Scf-Status: 433
< 
* Connection #0 to host 1301944331-klbf43hm49.ap-guangzhou.tencentscf.com left intact

SSE似乎没有按照文档写的那样,yield值给我,为啥呢?

后面我又在前面加了一个路由:

代码语言:txt
复制
@app.route('/')
def test():
  return 'Hello world'

使用curl是正常的:

代码语言:txt
复制
curl https://*********************.ap-guangzhou.tencentscf.com
Hello world%

说明是完全没问题的。那为什么SSE就用不了呢?

回答

和开发者交流更多问题细节吧,去 写回答
相关文章

相似问题

相关问答用户
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档