socket.io README

The project's README from github.com/socketio/socket.io. As one markdown file: README.md.

socket.io

Latest NPM version Build status Downloads per month

Getting Started

Please check our documentation here.

Questions

Our issues list is exclusively reserved for bug reports and feature requests. For usage questions, please use the following resources:

Security

If you think that you have found a security vulnerability in our project, please do not create an issue in this GitHub repository, but rather refer to our Security Policy.

Issues and contribution

Please make sure to read our Contributing Guide before creating an issue or making a pull request.

Thanks to everyone who has already contributed to Socket.IO!

License

MIT

socket.io (socketio/socket.io)

Searching Database…

63.2K ·GitHub
这是什么?Socket.IO 是一个库,可以在 Node.js 服务器与浏览器或移动应用等客户端之间实现双向、低延迟的实时通信。
这是独立的服务器,还是我要加到现有应用里的库?它是一个库:在 Node.js 服务器上安装 socket.io 包,在浏览器或应用里安装对应的 socket.io-client 包,通过网络把两者连接起来。
我该怎么让它跑起来?本 README 不直接列出安装步骤,而是引导你查看 Socket.IO 官方文档,了解设置和用法。
运行服务器端需要 Node.js 吗?需要。服务器端的包是为在 Node.js 上运行而构建的,项目本身使用 TypeScript 编写。
连接底层到底是用什么传输机制实现的?仓库的 CI 工作流显示,它基于独立的 “engine.io”、“engine.io-client” 和 “engine.io-parser” 子项目构建。这些子项目在 Socket.IO 的 API 底下负责底层传输(WebSocket,并带有降级方案)。
能否在多个服务器实例之间扩展?可以。代码库提供了专门的 “socket.io-adapter” 组件(在其 CI 配置中可以看到),在水平扩展时用它把事件广播给通过不同服务器进程连接的客户端。
为什么要用 Socket.IO,而不直接用原生 WebSocket 连接?Socket.IO 在原生 WebSocket 之上提供了自动重连、降级传输方式和基于事件的 API,而普通的 WebSocket 连接开箱即用并不具备这些功能。
什么是 engine.io?Engine.io 是 Socket.IO 所基于的底层传输模块。仓库的 CI 配置显示,engine.io、engine.io-client 和 engine.io-parser 是持续维护的子项目。
使用上的问题应该去哪里问,而不是提交 issue?GitHub issues 只用于报告 bug 和提出功能请求。如需使用帮助,维护者会引导你查看文档、故障排查指南、Stack Overflow 或 GitHub Discussions。
是否支持跨多个服务器向客户端广播?支持,通过 socket.io-adapter 包实现。它负责把事件广播给连接在不同服务器实例上的 socket,例如在水平扩展的部署中。
Creator
socketio
Size
33 MB
Stars
63.2K
Age
16y
Commits · 90 Days