I am working on an api based on laravel version 5.3.
It’s going to be like Telegram api that can respond to various clients that written with android, iOS or web version(angularjs).
One thing that is an Impartible part of that kind of api is realtime operations.
According to the survey that I did there is a signalR library for ASP.NET that makes developing real-time web functionality easy for ASP.NET developers.
SignalR supports Web Sockets, and falls back to other compatible techniques for older browsers like :
- Server-sent Events
- forever frame
- Long-polling
Now I wanted to know that for php and specifically Laravel, Is there a tool that is also easy to write realtime apis?
2
Answers
Laravel offers broadcasting as a feature to send server-side events to clients.
As for clients there is a javascript package which can be implemented
You can read it up in the Laravel Docs
you can use socket.io with Redis for angular client and Laravel backend
publish messages on redis from Laravel -> subscribe to redis in a node server and emit messages to socket io -> get messages using socket.io in angular client
you may need to configure reverse proxy in your apache virtual host configuration to node server for all ws requests