emit
Emits a socket event.
server.emit(event, ...data, [ackFn])
Emits a socket event.
server.emit("news", data1, data2, function(ackData){
console.log("Client acknowledged", ackData);
});
Parameters
- event
{string}
:The name of the socket event.
- data
{*}
:Data to be sent with the event. Socket.io allows to send more than one data objects.
- ackFn
{function}
:The acknowledgement function that will be executed if the receiver calls the acknowledgement callback.