The server don't send back anymore messages to their sender

This commit is contained in:
Yann Flory
2016-04-07 11:27:14 +02:00
parent eb4ea7a6b0
commit cf9f60bd57
4 changed files with 37 additions and 20 deletions

View File

@@ -294,14 +294,17 @@ define([
// Open a Chainpad session
realtime = createRealtime();
// On sending message
// Sending a message...
realtime.onMessage(function(message) {
// Prevent Chainpad from sending authentication messages since it is handled by Netflux
// Filter messages sent by Chainpad to make it compatible with Netflux
message = chainpadAdapter.msgOut(message, wc);
if(message) {
wc.send(message).then(function() {
// Send the message back to Chainpad once it is sent to all peers if using the WebRTC protocol
if(rtc) { onMessage(wc.myID, message); }
// Send the message back to Chainpad once it is sent to the recipients.
onMessage(wc.myID, message);
}, function(err) {
// The message has not been sent, display the error.
console.error(err);
});
}
});