From 6ba6b951bf07837235292135c434fcf7c61dcee0 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Thu, 16 Apr 2020 22:25:12 +0200 Subject: [PATCH] Changed mercure topics to be dash-cased --- CHANGELOG.md | 5 ++++- module/Core/src/Mercure/MercureUpdatesGenerator.php | 2 +- module/Core/test/Mercure/MercureUpdatesGeneratorTest.php | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 429c521a..57d41f0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this Thanks to that, Shlink will be able to publish events that can be consumed in real time. - For now, only one topic (event) is published, identified by `https://shlink.io/new_visit`, which includes a payload with the visit and the shortUrl, every time a new visit occurs. + For now, two topics (events) are published, when new visits occur. Both include a payload with the visit and the shortUrl: + + * A visit occurs on any short URL: `https://shlink.io/new-visit`. + * A visit occurs on short URLs with a specific short code: `https://shlink.io/new-visit/{shortCode}`. The updates are only published when serving Shlink with swoole. diff --git a/module/Core/src/Mercure/MercureUpdatesGenerator.php b/module/Core/src/Mercure/MercureUpdatesGenerator.php index 513b8e50..aad072f2 100644 --- a/module/Core/src/Mercure/MercureUpdatesGenerator.php +++ b/module/Core/src/Mercure/MercureUpdatesGenerator.php @@ -15,7 +15,7 @@ use const JSON_THROW_ON_ERROR; final class MercureUpdatesGenerator implements MercureUpdatesGeneratorInterface { - private const NEW_VISIT_TOPIC = 'https://shlink.io/new_visit'; + private const NEW_VISIT_TOPIC = 'https://shlink.io/new-visit'; private ShortUrlDataTransformer $transformer; diff --git a/module/Core/test/Mercure/MercureUpdatesGeneratorTest.php b/module/Core/test/Mercure/MercureUpdatesGeneratorTest.php index f72cd82d..992e25d6 100644 --- a/module/Core/test/Mercure/MercureUpdatesGeneratorTest.php +++ b/module/Core/test/Mercure/MercureUpdatesGeneratorTest.php @@ -60,7 +60,7 @@ class MercureUpdatesGeneratorTest extends TestCase public function provideMethod(): iterable { - yield 'newVisitUpdate' => ['newVisitUpdate', 'https://shlink.io/new_visit']; - yield 'newShortUrlVisitUpdate' => ['newShortUrlVisitUpdate', 'https://shlink.io/new_visit/foo']; + yield 'newVisitUpdate' => ['newVisitUpdate', 'https://shlink.io/new-visit']; + yield 'newShortUrlVisitUpdate' => ['newShortUrlVisitUpdate', 'https://shlink.io/new-visit/foo']; } }