Skip to content
⚡️ multi room chat app demo, powered by socket.io
Handlebars JavaScript HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
public init Aug 13, 2015
views init Aug 13, 2015
.gitignore Merge branch 'master' of github.com:wuyanxin/chatapp-demo Aug 13, 2015
LICENSE Initial commit Aug 13, 2015
README.md
app.js
package.json init Aug 13, 2015

README.md

文章:http://www.jianshu.com/p/40d8bc17529f

多房间聊天

socket.io提供rooms和namespace的API 用rooms的API就可以实现多房间聊天了,总结出来无外乎就是:join/leave room 和 say to room

// join和leave
io.on('connection', function(socket){
  socket.join('some room');
  // socket.leave('some room');
});

// say to room
io.to('some room').emit('some event'):
io.in('some room').emit('some event'):
运行效果

运行效果

You can’t perform that action at this time.