0
dbOperations.saveRequest(db, requestId, requestTime, location, eventData.citizenId, 'waiting', function(results) {
//2. AFTER saving, fetch nearby cops from citizen’s location
dbOperations.fetchNearestCops(db, location.coordinates, function(results) {
eventData.requestId = requestId;
//3. After fetching nearest cops, fire a 'request-for-help' event to each of them
for (var i = 0; i < results.length; i++) {
io.sockets.in(results[i].userId).emit('request-for-help', eventData);
}
});
});
});
我想發送事件給一個特定的警察,但不是所有......... ,我不完全得到如何io.socket.in工作可以任何人建議我aproper參考繼續plzzzzzzz ...........如何在命名空間socket.io中將客戶端與其他客戶端連接起來?
比你洙多兄弟。 –