isapir / lucee-websocket

Enables server WebSockets for Lucee via JSR-356 compliant servlet containers (e.g. Tomcat 8, Jetty 9.1, etc.)
GNU Lesser General Public License v2.1
17 stars 6 forks source link

Is it possible to create the application/session scopes? #16

Open redtopia opened 5 years ago

redtopia commented 5 years ago

I'm unclear as to how I could leverage model code within my application that relies on the existence of an application scope. For example, in member.cfc:

component {
    variables.dsn = application.config.dsn;
    ....

Since there is no application scope inside the listener code for a websocket, I cannot make this call (not to mention the mapping I typically use):

var member = createObject("common.cfc.member").init(userID);

Currently the way I got my websockets working is to replicate queries/logic that exist in my model layer. Understanding that this is not currently supported, would it be possible to create a page context for websockets so that you could access your application the same way as all your other code?

I know that we've spoken about this in the past, but would like to get a more clear understanding of what makes this impossible (if it is), or what impacts the choice to not implement it this way.

And if this is not possible, I would like to better understand what code changes I would need to make in order to gain access to model code that relies on the application scope, or how to remove dependencies on the application scope.