Library Search
结果页

WebSocket 实时聊天室 — ws 库实战

在 技术栈 中找到 8 个匹配结果。

返回文档库
技术栈

技术栈

8 个
查看全部
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% Node.js sages` 新增消息,data.json 文件实时更新 # Node.js WebSocket 实时聊天室 ## 目标 使用 `ws` 库构建多人在线聊天室,演示 Node.js 的事件驱动模型在实时通信中的优势。 ## 完整代码 ```javascript // server.js const WebSocket = require('ws'); const http = requir… 2% 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% Firebase Firestore # Firestore Hello World:实时聊天消息 ## 目标 连接 Firestore,创建聊天消息集合并实现实时监听——新增消息自动出现在客户端。 ## 完整代码 ### Web 版 (JavaScript) ```html <!DOCTYPE html> <html> <head> <title>Firestore 聊天室</title> </head> <body… 2% Vite | 框架 | URL | 冷启动 | HMR | |------|-----|--------|-----| | Vue 3 | localhost:5173 | < 1s | < 100ms | | React | localhost:5174 | < 1s | < 100ms | | Svelte | localhost:5175 | < 1s | < 100ms | Vite 真正实现了框… 1% Neo4j # Neo4j 从零到实战:社交网络图谱 ## 1. 背景与概念 ### 1.1 图数据库 vs 关系型数据库 在社交网络中,查询"朋友的朋友"在 SQL 中需要多次 JOIN(O(n²) 复杂度),而图数据库通过指针跳转做到 O(1)。 ``` SQL: SELECT * FROM friends f1 JOIN friends f2 ON f1.target = f2… 1% Apache Dubbo import com.example.api.GreetingRequest; import com.example.api.GreetingResponse; import com.example.api.GreetingService; import org.apache.dubbo.config.annotation.DubboReference; import org.springfram… 1%