Skip to content

Instantly share code, notes, and snippets.

@ostronom
Created December 6, 2016 14:26
Show Gist options
  • Save ostronom/df9b6808ac43c14712b557b7c96f57ed to your computer and use it in GitHub Desktop.
Save ostronom/df9b6808ac43c14712b557b7c96f57ed to your computer and use it in GitHub Desktop.
protected def interleaveDevices(devices: List[Device], busId: EventBusId, msgFactory: Device ⇒ ApiWebRTCSignaling): Future[Unit] = {
(devices |@| devices).tupled.filter(d => d._1.deviceId != d._2.deviceId).foldLeft(FastFuture.successful[Unit](())) {
case (acc, (left, right)) =>
acc *> postFromThisDevice(busId, left, msgFactory(right).toByteArray) *> postFromThisDevice(busId, right, msgFactory(left).toByteArray)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment