The task is to have a "simple chat, perhaps with a" future "(updates as a functional) in PHP."

My choice is not particularly great (since the project is written in php (laravel, I know about pusher)), then you need to look at ratchet more (if I understood everything correctly). I tried socket.io and ratchet - to be honest, I didn’t quite understand the essence. So, the question is: (now chat on the main page) does it make sense to put the chat on a separate page and make it on the node? (or what options are there at all?)

Ps: chat is purely for users to communicate, that is, I do not need strong bells and whistles (such as rooms), but nevertheless, I need live chat (and that's understandable). I didn’t have a case with a similar topic before, so I don’t know

Tell me, what will be the best to do?

Thank.

    2 answers 2

    I answered a similar question here: WebSocket with server part on php

    You need to create a chat, it means you need to use web sockets, there are libraries for this, they allow you to write it in a few dozen lines, it is enough just to implement interfaces. The link above has a full description of why and which libraries are best to use. You can write the server part on what you want, at least in PHP, even on NodeJs, there will not be any difference.

    The meaning of web sockets is that a socket is opened over your HTTP interface, through which the server application can send you messages, and you can send messages to it, such a bi-directional protocol.

      Why invent bikes? Here is a ready socket with examples https://github.com/morozovsk/websocket !

      There are also articles on Habré) with detailed explanations, divided into 3 parts by complexity:

      https://habrahabr.ru/post/209864/

      The advantages are that there are ready examples with working chats and even a small game!