skip to Main Content

I have developed a API for an android application using php, laravel,mysql and handle things at backend.

Now the application need realtime support chating .
I have no idea what to do at API side.
socket programming? Pusher?
Please help me.

I tried to use Ratchet. But it’s not complate, I mean everything is temporary and can not send message to specific user (admin)

2

Answers


  1. My suggestion would be to use pusher absolutely. I used it for a couple of my projects, depending on how much users your app has, you may be fine even with a free plan.

    But you do need to sit yourself down and slowly integrate BE and FE. But once you do, you will have a much better understanding of how it works, how to debug it and such. There are also a lot of tutorials and videos online to help you get started

    Login or Signup to reply.
  2. For realtime changes ( like chat system ) you definitely need to use sockets.

    You have multiple options to choose from.
    The 2 most popular ones are Socket.io and Pusher.

    With SocketIO, you’ll have do a lot more configuration on your own than Pusher.
    While Pusher is a paid solution. But, you don’t have to handle everything on your own ( Plus the free tier is also very good )

    Coming back to your specific need.
    On the backend side you need to create Channels and Events which will be fired when an action is triggered ( Like a message being added to database ).

    Then, you need to listen for this specific event in the given channel on the frontend side to receive the updates in realtime.

    Here’s more on events:
    https://laravel.com/docs/10.x/events

    And, there’s a complete tutorial on Pusher to create a Realtime Chat Application. Here’s the link to that:
    https://pusher.com/tutorials/chat-laravel/

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search