> For the complete documentation index, see [llms.txt](https://socket.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://socket.gitbook.io/docs/2-wen-dang-docs/2.1-gai-lan/broadcasting_messages.md).

# 2.1.10 广播消息

* 广播时不支持回调

要进行广播，只需添加广播标志即可发出和发送方法调用。 广播意味着向除了启动它的socket之外的所有人发送消息。

## Server

```javascript
const io = require('socket.io')(80)
io.on('connection',(socket)=>{
    socket.broadcast.emit('user connected')
    socket.broadcast.to('socketId').emit('hi',"hi") //给指定人发送
})
```
