I
I
iDennis2015-07-07 10:56:14
PHP
iDennis, 2015-07-07 10:56:14

How to make an http request to a specific client?

For example, 2 people went to the same site, one person sent an http request to the server, the server processed it, and the server needs to send an http request to the second person? How to do it? Through sockets?

Answer the question

In order to leave comments, you need to log in

6 answer(s)
A
Alexey Ukolov, 2015-07-07
@alexey-m-ukolov

The server cannot send a request to the client, it even follows from their names.
If you need to send some information to the client, then either periodic ajax requests, or long-polling, or web sockets are used for this.

M
Mikhail Alekseev, 2015-07-07
@Fandorin

Read algolist.manual.ru/web/servers.php

I
Ivan, 2015-07-07
@LiguidCool

Eeeee what?
Well, in principle, of course, through sockets, but in fact, read how the TCP protocol works. You can send a response while the connection is up. The implementation depends on the language, for example in PHP this task is entirely on Apache.

I
IvanOne, 2015-07-07
@IvanOne

this will help you How to send json file to browser using django?

S
sitev_ru, 2015-07-07
@sitev_ru

An HTTP request works like this:
1. Connects to the server
2. Request is sent
3. Request is processed by the server
4. Server sends a response to the client
5. Connection
disconnection , constantly asking "did you send me something?".
If this solution is not suitable - look towards WebSocket.

F
Fredcapit, 2015-07-16
@Fredcapit

Check out the SignalR solution. There, a different type of client-server interaction is implemented, depending on the availability of one or another method of establishing a connection. It is also relatively easy to manage connected clients, notify others about changes in their status, automatically reconnect when the connection is lost, etc.
It is very easy to implement a web chat based on it (at least in C#).
The WebRTC technology is very interesting. This is when it is possible to establish connections between clients directly, for example, to implement a video chat. True, for these purposes, additional elements are needed that will allow two clients to "find" each other on the network.
Theoretically, packets on the network are initially addressed by mac addresses, but developing technologies allow addressing (I mean various routing devices, switches, hubs ...) based on IP addresses.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question