freeCodeCamp/guide/chinese/nodejs/socket.io/index.md

30 lines
1.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
title: Socket.io
localeTitle: Socket.io
---
## Socket.io
[Socket.io](https://socket.io/)是一个Node.js库用于帮助实现计算机之间的实时通信。确保此Socket.io使用WebSockets在客户端的浏览器和服务器之间建立连接。该库使用[Engine.IO](https://github.com/socketio/engine.io)构建连接。
### 演示
为了体验可能的东西Socket.io提供了两个演示来展示它的可能用例。您可以在[https://socket.io/demos/chat/](https://socket.io/demos/chat/)找到演示,并在左侧找到白板演示的链接。
### 入门
由于Socket.io是一个Node.js库因此必须确保安装了Node.js. 如果尚未设置,请在[Nodejs.org上](https://nodejs.org/)获取最新版本
#### 苹果系统
Node.js也可以通过[Homebrew](https://brew.sh/)安装用于macOS的软件包管理器。
只需键入`brew install node`即可安装Node.js.
也可以在Socket.io的页面上找到[入门](https://socket.io/get-started/chat/)指南。它展示了如何轻松地在几行中建立实时聊天。
#### 更多信息
有关Socket.io及其文档的更多信息请访问
* [Socket.io](https://socket.io/)
* [Socket.io文档](https://socket.io/docs/)