Returns the live session ids for an MCP server as an array of strings, so a page can see which clients are connected and target one of them with mcpNotify( to= ). The server argument is optional inside a handler (it defaults to the server of the current call). When no server is running or no session matches, an empty array is returned.
mcpSessions( [ server ] )
→ returns array
Use mcpSessions() to see who is connected, then target a specific session with mcpNotify( to= ).
var sessions = mcpSessions( "/mcp/docs" );
writeOutput( "connected sessions: #arrayLen( sessions )#\n" );
Expected Result: An array of session id strings; empty when nobody is connected.
Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.