szmarczak / http2-wrapper

Use HTTP/2 the same way like HTTP/1
MIT License
240 stars 18 forks source link

Reuse sessions with many origins #20

Closed szmarczak closed 5 years ago

szmarczak commented 5 years ago

Fixes #17

szmarczak commented 5 years ago

The current implementation is bad because it requires another array for all sessions. Instead, we can move to something like this:

this.freeSessions = {
    [options]: [session]
};

To connect we need to do:

this.freeSessions[options].filter(session => {
    return session.originSet.includes(origin);
})

We get an array of sessions we can use.

szmarczak commented 5 years ago

Moved to #21