Socket.io acknowledgement in Nest.js : <p>I'm trying to enable usage of socket.io acknowledgement callbacks in Nest.js WebSocketGateways.</p>

<p>I'd like to be able to emit this:</p>

<pre><code>socket.emit('event', 'some data', function (response) { //do something });
</code></pre>

<p>And use the message handler like this:</p>

<pre><code>@SubscribeMessage('event')
onStart(client, data, ack) {
  //Do stuff
  ack('stuff completed');
}
</code></pre>

<p>According to <a href="https://github.com/nestjs/nest/issues/249" rel="noreferrer">this</a> issue there is no support for it in the library so you'd have to build your own websocket adapter. I tried it but am not sure how to do it exactly. I guess I need to do something special in the <code>bindMessageHandlers</code> function but my attempts have been in vain.
This is the <code>bindMessageHandlers</code> implementation in the default socket.io adapter bundled in the framework:</p>

<pre><code>public bindMessageHandlers(
  client,
  handlers: MessageMappingProperties[],
  process: (data: any) =&gt; Observable&lt;any&gt;,
) {
  handlers.forEach(({ message, callback }) =&gt;
    Observable.fromEvent(client, message)
      .switchMap(data =&gt; process(callback(data)))
      .filter(result =&gt; !!result &amp;&amp; result.event)
      .subscribe(({ event, data }) =&gt; client.emit(event, data)),
  );
}
</code></pre>

<p>Does anyone have any pointers on how I would go about implementing this?<br>
Thanks in advance!</p>
