sendEventEmitterAck method
dynamic
sendEventEmitterAck(
- dynamic method,
- dynamic data
send request emit to socket server and wait for response
Implementation
sendEventEmitterAck(method, data) async {
log('sendRequestEmitterAck() [method: $method, data: $data]');
final completer = Completer<dynamic>();
final requestId = _socket.id;
_socket.emitWithAck(
'request',
{
'method': method,
'data': data,
'requestId': requestId,
},
ack: (response) {
log('Event $method: $response');
completer.complete(response[1]);
},
);
return completer.future;
}