Y
Y
yury_borisov72017-07-02 14:51:07
Android
yury_borisov7, 2017-07-02 14:51:07

Socket server in php for Android notifications, how best to implement?

Hello everyone, the task is to make notifications on android
In android, I connect to the server through sockets.
I have such a question, let's say user A wrote a message to user B, all this logic is processed by the controller, but another question arose: how can I send data from the controller to the socket server in order to notify user B, the socket server is just a script that is running.
I use Laravel
The only solution that I thought of is to put data from the controller into the memcash, and on the server through while (true) to watch and if there is, then send, but it seems to me that this endless loop will simply kill my server =]

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Alexander Aksentiev, 2017-07-02
@Sanasol

It is better not to implement a socket in PHP in any way.
https://laravel.com/docs/5.4/broadcasting

M
mitaichik, 2017-07-02
@mitaichik

Why don't you want to use Firebase? Permanent connection to the server is not a good approach, they say...

U
UksusoFF, 2017-07-02
@UksusoFF

What php websockets server are you using?
https://github.com/nekudo/php-websocket
https://github.com/Devristo/phpws
socketo.me

A
Alex Wells, 2017-07-04
@Alex_Wells

In ANY situation, DO NOT use PHP websockets, AT ALL

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question