Streaming (but finite) inter-service communication flawed by half-closed websocket implementation

Consider a ServiceCall[Source[Id, NotUsed], Source[EntityForId, NotUsed]], which basically returns you the entities for a finite but long (that’s why it’s a Source) list of Ids.

The caller of this will most likely miss the last few Entities as the websocket will already be closed too early.

This by itself is an Akka HTTP issue, but as websockets are used transparently for interservice communication in Lagom, I believe this should not happen. A User shouldn’t have to add complicated code to handle “synchronized-completion”.

Thoughts?

A minimal example show casing the issue is described here. A workaround is included too.