var Realtime = require('leancloud-realtime').Realtime;
var TextMessage = require('leancloud-realtime').TextMessage;
var ms = realtime.createIMClient('black');
var send = function (unid, nr) {
console.log('send:',unid)
ms.then(function (black) {
return black.createConversation({
members: [unid],
name: 'black & ' + unid,
unique: true,
});
}).then(function (conversation) {
//这里有输出语句的话就没反应,不会输出
return conversation.send(new TextMessage(nr));
}).then(function (message) {
console.log('black & ' + unid, '发送成功!');
}).catch(console.error);
}