2.4.1.1.12. WebSocket and EventSource
Attention!
The technologies are available on shared and business hosting, but full WebSocket operation is only possible on business hosting using web apps.WebSocket — allows to establish a persistent connection to the server that can send and receive data.
EventSource — allows to establish a persistent connection to the server, which can only send events in text/event-stream format to the client and does not receive data. It is used in situations when data transfer from client to server is not required, for example, in news feeds, for status updates in social networks, etc.
Resource usage
Since WebSocket and EventSource technologies create a persistent connection with the server to exchange or transfer data, it generates on the hosting +1 constantly running process (in the case of using PHP). For example, if the current plan limit is conditionally 50 processes, and 51 visitors connected to the sockets, the latter will have to wait until someone disconnects. While all server resources will be busy, new visitors will not be able to get to the site.
The optimal option for using these technologies is web apps, which can control all connections with just 1 constantly running process. In this case, the limit on the number of concurrent processes will not be reached.
Enable
WebSocket and EventSource support is enabling in the "Site settings" section on the "Main settings" tab:
It's worth keeping in mind that enabling this option by itself doesn't provide any load until scripts are implemented on the site that will allow these technologies to work and occupy processes.