All Downloads are FREE. Search and download functionalities are using the official Maven repository.

sttp.client4.impl.zio.ZioServerSentEvents.scala Maven / Gradle / Ivy

package sttp.client4.impl.zio

import sttp.capabilities.zio.ZioStreams
import sttp.model.sse.ServerSentEvent
import zio.stream.ZPipeline

object ZioServerSentEvents {
  val parse: ZioStreams.Pipe[Byte, ServerSentEvent] = { stream =>
    stream
      .via(ZPipeline.utf8Decode)
      .via(ZPipeline.splitLines)
      .split(_.isEmpty)
      .map(c => ServerSentEvent.parse(c.toList))
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy