title: What's the simplest way to use SSE with Redis pub/sub and Akka Streams?
body: <p>I'd like to stream a chunked server sent event for the following scenario:</p>
  
  <p>Subscribe to a Redis key, and if the key changes, stream the new value with Akka Streams. It should only stream if there are new values.</p>
  
  <p>As I understand it, I need a <code>Source</code>. I guess that is the subscription to a channel:</p>
  
  <pre><code>redis.subscriber.subscribe("My Channel") {
    case message @ PubSubMessage.Message(channel, messageBytes) =&gt; println(
      message.readAs[String]()
    )
    case PubSubMessage.Subscribe(channel, subscribedChannelsCount) =&gt; println(
      s"Successfully subscribed to $channel"
    )
  }
  </code></pre>
  
  <p>In my route I need to create a <code>Source</code> from this, but honestly I don't know how to get going:</p>
  
  <pre><code>val route: Route =
    path("stream") {
     get {
       complete {
         val source: Source[ServerSentEvent, NotUsed] =
           Source
            .asSubscriber(??) // or fromPublisher???
        .map(_ =&gt; {
          ??
        })
        .map(toServerSentEvent)
        .keepAlive(1.second, () =&gt; ServerSentEvent.heartbeat)
        .log("stream")
       }
     }
  </code></pre>