Commit b9dafc49 authored by Killian Kemps's avatar Killian Kemps

Display current user

parent 23fc6ae1
......@@ -11,6 +11,7 @@ app.get('/', function(req, res){
});
var lastThreadID = '';
var currentUserID = 0;
var fbApi = {};
function loginFacebook () {
......@@ -38,10 +39,18 @@ function loginFacebook () {
}
io.on('connection', function(socket){
console.log('Listening for messages...');
loginFacebook().then(
function(api) {
currentUserID = fbApi.getCurrentUserID();
facebookMessengerService.getUserInfo(api, currentUserID).then(
function(data) {
console.log(data);
io.emit('chat message', 'Logged in as ' + data);
});
}).then(
function() {
fbApi.listen(function callback(err, message) {
console.log('Listening for messages...');
if (err) return console.error(err);
console.log(message);
lastThreadID = message.threadID;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment