Library Search
结果页websocket
在 元器件 / 技术栈 / 知识库 中找到 9 个匹配结果。
技术栈
技术栈
4 个 FastAPI self.active_connections: Dict[str, List[WebSocket]] = {}
async def connect(self, room: str, websocket: WebSocket):
await websocket.accept()
if room not in self.active_connections:… 3% Fiber /fiber/v3"
"github.com/gofiber/contrib/websocket"
)
type SensorData struct {
Timestamp int64 `json:"timestamp"`
Temperature float64 `json:"temperature"`
Humidity float64 `json:"humidity"`… 3% C# ```html
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<title>Alpine.js Demo</title>
<style>
body { font-family: system-ui; max-width: 600px; margin: 50px auto; background: #… 2% Node.js sages` 新增消息,data.json 文件实时更新
# Node.js WebSocket 实时聊天室
## 目标
使用 `ws` 库构建多人在线聊天室,演示 Node.js 的事件驱动模型在实时通信中的优势。
## 完整代码
```javascript
// server.js
const WebSocket = require('ws');
const http = requir… 1%
知识库
知识库
5 个 02-进阶实战-WebSocket-后台任务-部署 # FastAPI 进阶实战 —— WebSocket、后台任务与部署
## 本章目标
- 实现 WebSocket 实时通信
- 使用 BackgroundTasks 处理异步后处理
- FastAPI + Celery 重型任务
- Docker + Nginx + Uvicorn 生产部署
## 1. WebSocket 实时通信
```python
from fastapi imp… 3% Fiber WebSocket 传感器实时看板 # Fiber WebSocket 实时数据推送
## 目标
使用 Fiber WebSocket 实现服务端定时推送模拟传感器数据(温度/湿度),前端实时折线图展示——典型 IoT/毕设看板场景。
## 后端代码
```go
package main
import (
"encoding/json"
"log"
"math/rand"
"sync"
"time"
"gith… 3% WebSocket 实时聊天室 — ws 库实战 # Node.js WebSocket 实时聊天室
## 目标
使用 `ws` 库构建多人在线聊天室,演示 Node.js 的事件驱动模型在实时通信中的优势。
## 完整代码
```javascript
// server.js
const WebSocket = require('ws');
const http = require('http');
const fs = require(… 3% ESP32-C3 Super Mini — 代码例程 void webSocketEvent(uint8_t num, WStype_t type, uint8_t* payload, size_t len) {
// 不需要处理客户端消息
}
void setup() {
Serial.begin(115200);
WiFi.begin(ssid, pass);
while (WiFi.status()… 2% AS608 光学指纹传感器 — 代码例程 (STM32 + Arduino) void sendPacket(uint8_t cmd, uint8_t *data, uint16_t len) {
uint16_t pktLen = len + 2;
as608Serial.write(0xEF);
as608Serial.write(0x01);
as608Serial.write((AS608_ADDR >> 24) & 0xFF);… 1%