A
A
Albert Kazan2018-03-16 08:03:06
PHP
Albert Kazan, 2018-03-16 08:03:06

Are there working websocket examples?

Tried reading a few documentations on various sockets and their underlying implementations. But I did not understand how to make a working application out of it.
Can you tell me ready-made solutions for PHP + (something) with descriptions of actions and how each "thing" works. This requires the ability to send / communicate with specific user(s), and not a general chat, as shown in most examples.
ps I think that this garbage will help speed up the application of the card game. Now the interaction happens through AJAX, but it turned out to be too slow and heavy.

Answer the question

In order to leave comments, you need to log in

8 answer(s)
S
Sergey Gavrilov, 2018-03-16
@nsleep

Sockets on php perversion. Use php+redis+nodejs.
Php receives events (chat messages) and sends them to radish, the node subscribes to a channel in radish and sends messages to the necessary channels in WS.
If you want to mess with sockets in php, look towards Ratchet.

M
marataziat, 2018-03-16
@marataziat

php+realtime=BDSM. Learn what WS is, for WS nodejs has socket.io. By the way, you can use the ready service deepstream.io

A
Abdula Magomedov, 2018-03-16
@Avarskiy

Here: Simple chat. Laravel. Redis. Socket.io

V
Viktor, 2018-03-16
@Levhav

Take a look at my comet server project https://comet-server.com/ the project is written in C++ but provides a simple api for sending messages to websockets. Here is an article about adding real time functions https://habrahabr.ru/post/341662/ to the finished site. And there is a lot of documentation in Russian.

R
ReFeRy, 2018-03-16
@ReFeRy

I myself am now fastening sockets to the old site on php. I found a very simple option for mastering: https://habrahabr.ru/post/331462/
It is in this article that an example is available (with source code) for sending messages to a specific user. On pure php, without everything else.
I already got it. I can't say anything about performance yet.

S
ssrdop, 2018-03-17
@ssrdop

Here is a good tutorial. Video The
ratchet library is used. There are 2 parts in the video. Everything is very detailed.
You can also use the workerman library.

Z
zvonok1337, 2018-03-17
@zvonok1337

There is such a product wsphp.net
C++ server that allows you to execute php scripts
. You connect through the browser to the WS server in c++, it processes the command and sends it to the php script.

A
Andrew, 2018-03-22
@iCoderXXI

Websockets and PHP... My friend is an expert in perversions... :D

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question