Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USER: encapsulated user connections #2

Open
seitbekir opened this issue Sep 10, 2017 · 1 comment
Open

USER: encapsulated user connections #2

seitbekir opened this issue Sep 10, 2017 · 1 comment

Comments

@seitbekir
Copy link
Owner

As a developer interested to working with users, that might be connected from many devices (also, on different server instances if server is scaled), service has to give approach, that will encapsulate this.

Connection and user instance has to be available from req var.

example of user instance:

app.use((req, res, next) => {
    req.user.push({
        message: 'single message from server',
    })
})

example of connection instance:

app.use((req, res, next) => {
    req.connection.push({
        message: 'single message from server for only current connection',
    })
})

availability of user from API:

app.use((req, res, next) => {
    let someUserId = 25;
    req.socket.user(someUserId).push({
        message: 'single message from server for only current connection',
    })
})
@seitbekir
Copy link
Owner Author

User Object Created

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant