Running the Mercure Service in the symfony Binary
Mercure itself is a "service" or "server" - kind of like MySQL or Elasticsearch.
The Mercure server is called the "hub"... and there are several good ways to get
it running. First, they have a managed version where they ...
Mercure Pushing Stream Updates Async
... web server to push information
to a browser without us needing to make an Ajax call to ask for it.
And fortunately, in the Symfony world, we have great support for a technology that
enables server-sent events: Mercure ...
Mercure Hub's JWT Authorization
Can anyone publish a message to any topic on a Mercure hub? Definitely not.
So how does the Mercure Hub know that we are allowed to publish this message?
It's entirely thanks to this long string that we're passing to ...
Publishing Mercure Updates in PHP
We now know that we can easily subscribe to a Mercure topic in JavaScript.
And, if we publish a message to that topic with <turbo-stream> HTML in it,
our JavaScript will instantly notice & process it. Sweet!
So far ...
Entity Broadcast
... There's one super cool feature of the Turbo Mercure UX package that we installed
earlier that we have not talked about. And it's this: the ability to publish a
Mercure update automatically whenever an entity is created ...
Turbo Stream Responses
... similar to how the Turbo and
Mercure integration works. If you don't know, Mercure is a tool that allows you
to get real-time updates on your front end... kind of like web sockets, but cooler.
And Mercure pairs really ...
Listening Publishing
The purpose of Mercure is to have a hub where we can subscribe - or listen - to
messages and also publish messages.
Here's our high-level goal, it's three steps. First, set up some JavaScript that
listens to a "topic ...
Turbo Stream for Instant Review Update
... the controller.... so we chose to return a
stream... which means that the stream needs to update both sections of the page.
Okay. So why are we talking about all of this again? Because now that we have
Mercure running, we ...
Visually Highlighting new Items that Pop onto the Page
... currently publishing updates to Mercure from inside of our
controller. But the Mercure Turbo UX package that we installed earlier makes it
possible to publish updates automatically whenever an entity is updated, added
or removed. It's pretty incredible, and it's our next topic.
Installing API Platform
... you a production-ready web server with
extra tools like Mercure for real-time updates. It's the most powerful way to use
API Platform.
But... in this tutorial, we're not going to use it. I hate nice things! No,
we'll ...
Smartly Updating Elements for all Users
With the power to return a normal redirect from our controller and publish a Mercure
update to modify any part of any user's page, we can now really clean up our
review system. After a successful form submit, we ...
Turbo Drive Frames Streams
... app. Crazy, right?
When you use Turbo Streams along with Mercure, this can even give you the ability
to make a real time chat app... while writing zero JavaScript.
And you're free to use all three parts... or just one ...
Worker Command
... totally different topic, and one that's covered by the Mercure component in
Symfony.
And... that's it! This messenger:consume command is something that you'll have
running on production all the time. Heck, you might decide ...
17
mercure
Filter Results