From 1ca6fa79eecbc8ddf02ada8d49ac996541f8eb5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20Bj=C3=B6rklund?= Date: Thu, 8 Jul 2021 13:33:11 +0200 Subject: [PATCH] Add notifications method to Session The documentation state that there should be a notifications function on the Session to get events from all subscribed channels: https://tpolecat.github.io/skunk/tutorial/Channels.html#listening-to-a-channel The function existed on the protocol level but was missing in the Session. --- modules/core/src/main/scala/Session.scala | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/core/src/main/scala/Session.scala b/modules/core/src/main/scala/Session.scala index 873c63f0a..5220ae407 100644 --- a/modules/core/src/main/scala/Session.scala +++ b/modules/core/src/main/scala/Session.scala @@ -187,6 +187,10 @@ trait Session[F[_]] { */ def describeCache: Describe.Cache[F] + /** + * Stream for all notifications on all subscribed channels. + */ + def notifications(maxQueued: Int): Stream[F, Notification[String]] } @@ -413,6 +417,9 @@ object Session { override def describeCache: Describe.Cache[F] = proto.describeCache + override def notifications(maxQueued: Int): Stream[F, Notification[String]] = + proto.notifications(maxQueued) + } } } @@ -470,6 +477,8 @@ object Session { override def describeCache: Describe.Cache[G] = outer.describeCache.mapK(fk) + override def notifications(maxQueued: Int): Stream[G, Notification[String]] = + outer.notifications(maxQueued).translate(fk) } }