0
我想推送一個通知,如果套接字收到。錯誤:未捕獲,未指定「錯誤」事件。 ([對象對象])
服務器端:
if(data.handle.length > 0 && data.message.length > 0){
io.sockets.emit('chat', data);
} else {
socket.emit('error');
}
客戶端:
socket.on('error', function(){
$.amaran({
'theme' :'colorful',
'content' :{
bgcolor:'red',
color:'#fff',
message:'Please enter your name, and message and try again.'
},
'position' :'top right',
'outEffect' :'slideBottom'
});
});