Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

emitting event on socket.io using async await

async function doesSocketAgree(){
  await new Promise(resolve => {
    socket.emit('doesOtherSocketAgree', otherSocketId, (answer) => {
      resolve(answer);
    });      
  });
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #emitting #event #async #await
ADD COMMENT
Topic
Name
6+3 =