Hi community,
I'm using ws module on node.js and I'm trying to send a notification to a
webrtc client when I receive a facebook chat from a facebook user, but I
can't integrate ws code with node.js code for facebook API.
I have this node.js code using ws module:
var WebSocketServer = require('ws');
var wss = new WebSocketServer.Server({port: 8080});
wss.on('connection', function(ws) {
ws.on('message', function(message) {
console.log('received: %s', message);
});
ws.send('something');
});
And I have this node.js code for facebook api:
function sendTextMessage(recipientId, messageText) {
((HERE I NEED TO MAKE A ws.send('something'); ))
var messageData = {
recipient: {
id: recipientId
},
message: {
text: 'hi, I'm a bot',
metadata: "DEVELOPER_DEFINED_METADATA"
}
};
callSendAPI(messageData);
}
LAST CODE (facebook) is taken from a code published as example on facebook
quick start tutorial such as "first steps with facebook messenger
platform"(https://github.com/fbsamples/messenger-platform-samples/blob/master/node/app.js)
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/00b16f96-2a76-438b-9a29-d6b900a7683d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.