php: How to save the client socket (not closed), so a further script may retrieve it to send an answer?

前端 未结 2 415
别跟我提以往
别跟我提以往 2021-01-14 04:48

I have a client-server application, in which the server may require to send information back to clients.

As the client-server pattern does not allow the server to \"

2条回答
  •  情歌与酒
    2021-01-14 04:59

    One way to solve it - forget about sockets.

    Pseudocode:

    // receive request, set some session_id if not exists
    // request contains last_timestamp, so we know which data client already have
    // check have we any dataset for this session_id after last_timestamp
    // return this dataset, or no_new_data signature
    

    Data can be stored in database, for example.

提交回复
热议问题