我有一个主意,但我有一些问题...如何将Facebook用户连接到节点应用程序-socket.io
我创建了一个socket.io聊天,但现在想允许Facebook用户聊天来创建类似Facebook群组CHAT的聊天。我认为这个主意很好?
这是我的聊天代码:
服务器端文件-app.js
var app = require('express').createServer()
var io = require('socket.io').listen(app);
app.listen(8080);
// routing
app.get('/', function (req, res) {
res.sendfile(__dirname + '/index.html');
});
// usernames which are currently connected to the chat
var usernames = {};
// rooms which are currently available in chat
var rooms = ['room1','room2','room3'];
io.sockets.on('connection', function (socket) {
// when the client emits 'adduser', this listens and executes
socket.on('adduser', function(username){
// store the username in the socket session for this client
socket.username = username;
// …
Run Code Online (Sandbox Code Playgroud)