You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was curious about what was best practice in terms of using acknowledgments vs event emitting. Also what overheads there are for using acknowledgments. For example:
Client side:
function processResults(serverData){
// Some (potentially large) amount of code for sorting through the servers data
}
socket.emit('get data', processResult);
socket.on('get data response', (serverData) => {
// Some (potentially large) amount of code for sorting through the servers data
});
socket.emit('get data');
So my question is: is there any issue with taking this approach?
I've been looking around and primarily only seen acknowledgments used to give simple responses back to the client rather than running more involved functions.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I was curious about what was best practice in terms of using acknowledgments vs event emitting. Also what overheads there are for using acknowledgments. For example:
Client side:
Server side:
vs.
Client side:
Server side:
So my question is: is there any issue with taking this approach?
I've been looking around and primarily only seen acknowledgments used to give simple responses back to the client rather than running more involved functions.
Beta Was this translation helpful? Give feedback.
All reactions