mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 02:18:26 +00:00
Add websockets and notify frontend when an item is processed
This commit is contained in:
@ -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"))
|
||||
}
|
@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user