Skip to content
Insights

Real-time chat with Laravel, React & Node.js

real time

For the odisee MyCompass project that we recently finished we created a real-time chat. For this we used Laravel, React and Laravel echo server

As a user, you can chat directly with your coach, and in today's world such things need to be synchronized: if your coach is available, you want to be able to chat directly with him without delays. These conversations are confidential, so of course we also have to make sure that this happens in a safe and reliable way.

That's why we've built in several layers of security.

The user presses send and this sends a POST request with the content of the message to the API. The API processes this message, stores it in the database and puts in a queue a message with this content:

1
{"user-id": "42", "sender": "9", "content": "new-message"}.

If the queue is then processed by supervisor (process that is always kept running), a message is sent to the NodeJS server.
This in turn sends a push message trough a websocket to the browser of just this one user (42). When that has arrived, that user's browser asks the API to retrieve "new-message" messages in the conversation with user 9.

Because only a new-message is forwarded, and the content of that message itself has to be retrieved separately, all this remains secure. So the socket only gets information about new messages and the content of that message remains behind the regular API.

By using already existing packages, this is easy to implement. We did not have to write our own code for the NodeJS part, but were able to build completely on the existing package. For the part in Laravel we wrote a custom broadcast service and a custom notification class.

On the React side of the application we can use an already existing socket.io implementation, so also for this we could rely on an already existing code.

Want to know more about the project?

Would you like to read more about how we made this case a successful platform?

More insights

  • SymfonyCon 2025

    At Codana, we continue to lead the way in the world of custom software. That is why we were present once again last year at SymfonyCon 2025, held in Amsterdam's iconic convention center. With more than 30 talks spread across three tracks, one central theme emerged: how will we build even faster and more intelligent custom web apps in 2026?

    SymfonyCon 2025
  • Lightning Talks: Custom development x AI

    Recently, our experts shared their insights in two engaging lightning talks on how we integrate Artificial Intelligence (AI) to optimize our custom development processes, from the initial coding phase to refining the UX/UI design. This is a brief report on how we are bridging the gap between ideas and scalable, future-proof applications.

    Lightning Talks: Custom development x AI
  • Lightning Talks: The evolving role of AI in development

    The central question during our last Lightning Talks was: How can AI help us make this process smarter, faster, and more reliable, without replacing our human expertise?

    Lightning Talks: The evolving role of AI in development
  • Codana Lightning Talks | EAA Deadline & AI Code Editors

    The 2025 EAA deadline has passed. What now? Read our analysis of the accessibility law and a comparison of 4 AI assistants.

    Codana Lightning Talks | EAA Deadline & AI Code Editors
  • PHPverse 2025 Recap: Symfony, Laravel & AI

    Read our recap of PHPverse 2025. Discover key insights on FrankenPHP, Symfony, Laravel, AI, and the future of the language. 

    PHPverse 2025 Recap: Symfony, Laravel & AI
  • The European Accessibility Act (EAA): What Does It Mean for You?

    The European Accessibility Act (EAA): What Does It Mean for You?