ratchetphp / Ratchet

Asynchronous WebSocket server
http://socketo.me
MIT License
6.29k stars 747 forks source link

non-blocking session provider #134

Open WyriHaximus opened 11 years ago

WyriHaximus commented 11 years ago

Currently the session provider reads out session data in a blocking way. This is okey but not an option if we want to go for a full non-blocking websocket server. Creating an deferrable interface would allow for predis async to be used as well as still supporting sf2 sessions within a wrapper. It would make the plain sf2 sessions a bit more complicated but allows more adapters then just predis. Below is some pseudo code how it could be done.

interface {
    readSession(sessionId);
}
concrete class {
    readSession(sessionId) {
        promise = new promise;
        this->client->get(sessionId, promise);
        return promise;
    }
}

Another thing is should the onOpen call wait for the session to be retrieved or fire anyway and fire another call for the session data?

Possible adapters:

cboden commented 11 years ago

142

cboden commented 11 years ago

ping @nervo