Add websockets and notify frontend when an item is processed

This commit is contained in:
eikek
2021-11-06 21:32:07 +01:00
parent f38d520a1d
commit 3e58d97f72
17 changed files with 243 additions and 114 deletions

View File

@ -1,31 +0,0 @@
/*
* Copyright 2020 Eike K. & Contributors
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
package docspell.backend.msg
import java.util.concurrent.atomic.AtomicLong
import docspell.pubsub.api.{Topic, TypedTopic}
import io.circe.generic.semiauto.{deriveDecoder, deriveEncoder}
import io.circe.{Decoder, Encoder}
final case class Ping(sender: String, num: Long)
object Ping {
implicit val jsonDecoder: Decoder[Ping] =
deriveDecoder[Ping]
implicit val jsonEncoder: Encoder[Ping] =
deriveEncoder[Ping]
private[this] val counter = new AtomicLong(0)
def next(sender: String): Ping =
Ping(sender, counter.getAndIncrement())
val topic: TypedTopic[Ping] =
TypedTopic[Ping](Topic("ping"))
}

View File

@ -19,5 +19,5 @@ object Topics {
/** A list of all topics. It is required to list every topic in use here! */
val all: NonEmptyList[TypedTopic[_]] =
NonEmptyList.of(Ping.topic, JobDone.topic, CancelJob.topic, jobsNotify)
NonEmptyList.of(JobDone.topic, CancelJob.topic, jobsNotify)
}