PHP - WebSocket set specific client id

670 views Asked by At

I am working with PHP websockets. I am familiar with its basics but I cannot figure out that how can I set a specific ID for user. Now, by default the script sets 1, 2, 3 and so on according to the time the user connected but I want it to set ID which is stored in session. The script I am using is this. I have found the function which generates ID.

function wsGetNextClientID() {
    $i = 1; // starts at 1 because 0 is the listen socket
    while (isset($this->wsRead[$i])) $i++;
    return $i;
}

Is there any way that I can set a specific one?

0

There are 0 answers