mail socket scope in web app

Hey… I am experimenting with a multi user web app… So I was wondering, if I want to send a mail from the app, the socket should be a property of the app or the session ?
I’ve seen some examples where the mail socket belongs to the app, but what happens in that case if two users want to send an email at the same time ?


Actually, the socket should probably be a property of the page, container or dialog. The page being in the context of the session, you still have a unique socket for each user/process.

If I set the socket as a property of the page, I risk getting it out of scope if the user moves away from the page

I would suppose that if there is a need to send an email from another page, i would create another socket for that page. - That is the way my own aps are structured. A socket is open only as long as required. It is therefore only in scope of the current process.

Incidently, I use very few pages and instead embed containers as needed. My mail sockets are properties of the webcontainers. Each container is associated with a specific process step and so sockets are also specific and short lived.

I was surprised to find out that this isn’t quite true. If you’re opening webpages dynamically rather than using implicit instance, they stay open forever unless explicitly closed. The general design philosophy I used once ended up with tons of webpages still existing in memory. Showing a new page doesn’t implicitly close the one the user is on.

webpages are kept in memory for the session until you close the page or the session.

in a web app:
app and module properties, all shared properties, static variables -> global for all users
properties on session, web pages, controls, local variables -> local per user