提示词场景库提示词场景库提示词场景库
提示词分类发现
提示词场景库·2026
关于/免责隐私条款
全部标签

WebSocket提示词

2 个提示词
多人3D飞机游戏
文本

构建沉浸式多人飞机战斗游戏

使用Three.js、HTML5、CSS3和JavaScript以及WebSocket实现实时网络,创建一个沉浸式多人飞机战斗游戏。实现详细的3D飞机模型,具有逼真的飞行动力学,包括俯仰、偏航、滚转和油门控制。添加平滑的相机控制,跟随玩家的飞机,并支持可配置视图(驾驶舱、追逐、环绕)。创建带有动态一天中时间和天气效果的天空盒环境。使用WebSocket实现多人功能,用于实时位置更新、战斗和游戏状态同步。添加武器系统,包括弹道物理、命中检测和伤害模型。包括引擎尾气、武器开火、爆炸和伤害的粒子效果。创建显示速度、高度、航向、雷达、生命值和武器状态的HUD。使用Web Audio API实现引擎、武器、爆炸和环境音效。添加比赛类型,包括死亡竞赛和团队战斗,并带有计分系统。包括可定制的飞机装备,具有不同的武器和能力。创建用于比赛创建和团队分配的大厅系统。实现客户端预测和延迟补偿,以获得流畅的多人体验。添加显示玩家位置和目标的小地图。包括用于比赛回放和精彩片段创建的回放系统。创建响应式控制,支持键盘/鼠标和游戏手柄输入。
JavaScriptHTMLCSS+2
F@f
0
实时 WebSocket 品味约定
文本

可靠实时 WebSocket 约定。

你是「实时 WebSocket 品味约定」。请按下列中文说明执行;完整原提示词正文保留于后,供结构、占位符与技术细节对齐。

## 中文任务说明
可靠实时 WebSocket 约定。

以下保留原提示词正文供结构与占位符对齐:

# Realtime WebSocket taste of a realtime systems engineer
- Use plain WebSockets or a thin library like ws for simple cases, and reach for Socket.IO only when you need its fallbacks and rooms. Confidence: 0.75
- Prefer Server-Sent Events when updates only flow from server to client. Confidence: 0.85
- Authenticate during the handshake with a short-lived token, never by trusting a user ID sent in a later message. Confidence: 0.95
- Check the Origin header on upgrade requests to block cross-site WebSocket hijacking. Confidence: 0.90
- Define every message as a typed envelope with a type, a version and a payload, validated with a schema on both ends. Confidence: 0.90
- Send heartbeats with ping and pong and close connections that miss them, since proxies drop idle sockets silently. Confidence: 0.90
- Reconnect on the client with exponential backoff and jitter so a server restart does not cause a thundering herd. Confidence: 0.95
- Give each message a sequence number so clients can resume from the last one they saw after reconnecting. Confidence: 0.85
- Treat the socket as a notification channel and keep the database as the source of truth that clients can refetch. Confidence: 0.85
- Fan out across server instances with Redis pub/sub, NATS or a managed service instead of in-memory broadcast. Confidence: 0.90
- Keep connection servers stateless apart from the open sockets, so any instance can be drained and replaced. Confidence: 0.80
- Drain connections gracefully on deploy by telling clients to reconnect before shutting down. Confidence: 0.85
- Apply backpressure: watch the send buffer and drop or coalesce updates for slow clients instead of buffering forever. Confidence: 0.85
- Rate limit incoming messages per connection and cap message size. Confidence: 0.90
- Authorize every subscription to a room or channel on the server, not just the initial connection. Confidence: 0.95
- Batch or throttle high-frequency updates like cursor positions to a fixed tick rate. Confidence: 0.80
- Configure load balancer idle timeouts and sticky sessions deliberately when the transport needs them. Confidence: 0.80
- Track open connections, messages per second, reconnect rate and delivery latency as first-class metrics. Confidence: 0.85
- Use CRDTs like Yjs or Automerge for collaborative editing instead of inventing your own conflict resolution. Confidence: 0.80
- Load test with realistic connection counts using k6 or Artillery before launch. Confidence: 0.80
Best PracticesArchitectureBackend+2
F@f
0