Coldfusion Session / Application Scope Empty After calling Websockets WSPublish ()

I experience strange behavior with application / session scope in Coldfusion (2016 UPDATE 5) when using web sockets and calling WSPublish.

Below is the code that illustrates this anomaly:

<cfdump var="#application.Security.GetSession()#" label="1A application.Security.GetSession()">
<cfdump var="#session#" label="1B session">

<cfset wsPublish("notifications", "Test") />

<cfdump var="#application.Security.GetSession()#" label="2A application.Security.GetSession()">
<cfdump var="#session#" label="2B session">

In responses 1A and 1B, the session is returned as expcted.

Then I launched the WSPublish () function.

In 2A, the session is empty, but in 2B it still exists, as before.

So, after running WSPublish (), when I try to access a session by calling another CFC to get it (2A), it does not exist. However, the session does exist with direct access to it (2B).

The entire application.Security.GetSession () method does the following:

<cfcomponent output="no">
    <cffunction name="GetSession" returntype="any">
        <cfif NOT IsDefined("session")>
            <cfreturn StructNew() />
        <cfelse>
            <cfreturn session />
        </cfif>
    </cffunction>
</cfcomponent>

If I delete the WSPublish () call, 1A, 1B, 2A, 2B will return the correct session data.

WSPublish() ?

!

+6

All Articles