Hi !
I’ve encountered a problem when switching to reliable (with acknowledge) messages from server to client.
I’ve saw your implementation of Emit with Callback that allows the server to reply affirmative if it successfully received a message from the client, but now I need to implement the other acknowledgment direction (get a callback from client after a server emit).
To accomplish this, I think that I need to call a server defined function from the client, but the OnEvent (SocketIOClient) event only have two arguments instead of the required three (the actual implementation have Event and Message JSON but in order to accomplish this it should have Event, Message JSON and Server Ack Function)
Is it possible to extend the behaviour of the OnEvent implementation and enable it to reply a server acknoledgement request by function?
On the below link you can find some references:
https://socket.io/docs/server-api/#socketemiteventname-args-ack
And here you find the important code snippet:
io.on(‘connection’, (socket) => { socket.emit(‘an event’, { some: ‘data’ }); socket.emit(‘ferret’, ‘tobi’, (data) => { console.log(data); // data will be ‘woot’ }); // the client code // client.on(‘ferret’, (name, fn) => { // fn(‘woot’); // }); }); Thanks in advance!