Changed mercure topics to be dash-cased

This commit is contained in:
Alejandro Celaya 2020-04-16 22:25:12 +02:00
parent 8e0e11f3b3
commit 6ba6b951bf
3 changed files with 7 additions and 4 deletions

View File

@ -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.

View File

@ -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;

View File

@ -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'];
}
}