云函数 Web Function 能力推出后,对于原生框架的无改造直接部署,在性能和开发流程上,都受到了众多开发者的好评。在一期能力的基础上,Web Function 现已支持 WebSocket 协议,实现客户端和函数运行的服务端间建立长连接。
01.
工作原理

1. 服务启动与连接建立
2. WebSocket 连接生命周期
1. 创建函数



Python 示例:使用 WebSockets 库实现 WebSocket 服务端;
Python 示例获取地址:https://github.com/awesome-scf/scf-python-code-snippet/tree/main/ws_python
Node.js 示例:使用 WebSockets 库实现 WebSocket 服务端;
Node.js 示例获取地址:https://github.com/awesome-scf/scf-nodejs-code-snippet/tree/main/ws_node
WebSockets 库:https://github.com/websockets/ws
现已开启内测,识别下方 👇 二维码,立即申请体验!

Web Function 产品文档: https://cloud.tencent.com/document/product/583/56123 Web Function 快速体验链接: https://console.cloud.tencent.com/scf/list-create?rid=16&ns=default&keyword=WebFunc





GitHub: github.com/serverless 官网: cloud.tencent.com/product/serverless-catalog
文章转载自腾讯云云函数,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




