国产的类 firebase 实时数据库框架,可自行部署的 end.js 来了 | 36氪
var chat = new end('chat','http://localhost:8080'),
chatroom = chat.child(window.location.search.split('?')[1]),
chatmsgs = chatroom.child('msgs');
chatmsgs.on('child_added',function(msg){
$('.msgs').append('<div class="msg">'+msg.value.name+' : '+msg.value.text+'</div>');
});
$('#btn_send').click(function(){
var name = $('.txt_send_name').val();
var text = $('.txt_send_text').val();
chatmsgs.push({name:name,text:text});
});