[ { "id": "advanced-flow-tab", "type": "tab", "label": "WS Session Advanced Example", "disabled": false, "info": "Example showing connect, update config, and disconnect with data retrieval." }, { "id": "ws-session-node", "type": "fff-ws-session", "z": "advanced-flow-tab", "name": "Session Manager", "contextKey": "ws_sessions", "scope": "global", "x": 400, "y": 200, "wires": [ [ "debug-success" ], [ "debug-error" ] ] }, { "id": "inject-connect", "type": "inject", "z": "advanced-flow-tab", "name": "Connect User", "props": [ { "p": "status", "v": "{\"event\":\"connect\",\"_session\":{\"id\":\"user123\"}}", "vt": "json" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "x": 160, "y": 120, "wires": [ [ "ws-session-node" ] ] }, { "id": "inject-update", "type": "inject", "z": "advanced-flow-tab", "name": "Update Config", "props": [ { "p": "status", "v": "{\"event\":\"update\",\"_session\":{\"id\":\"user123\"},\"config\":{\"userId\":\"12345\",\"language\":\"es\",\"preferences\":{\"theme\":\"dark\"}}}", "vt": "json" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "x": 160, "y": 180, "wires": [ [ "ws-session-node" ] ] }, { "id": "inject-disconnect", "type": "inject", "z": "advanced-flow-tab", "name": "Disconnect User", "props": [ { "p": "status", "v": "{\"event\":\"disconnect\",\"_session\":{\"id\":\"user123\"}}", "vt": "json" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "x": 170, "y": 240, "wires": [ [ "ws-session-node" ] ] }, { "id": "inject-retrieve", "type": "inject", "z": "advanced-flow-tab", "name": "Retrieve Data", "props": [ { "p": "payload", "v": "", "vt": "date" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "x": 160, "y": 300, "wires": [ [ "function-retrieve" ] ] }, { "id": "function-retrieve", "type": "function", "z": "advanced-flow-tab", "name": "Get Session Data", "func": "var sessions = global.get('ws_sessions');\nif (sessions && sessions.has('user123')) {\n msg.payload = sessions.get('user123');\n} else {\n msg.payload = 'Session not found';\n}\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 380, "y": 300, "wires": [ [ "debug-retrieve" ] ] }, { "id": "debug-success", "type": "debug", "z": "advanced-flow-tab", "name": "Success Output", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 620, "y": 160, "wires": [] }, { "id": "debug-error", "type": "debug", "z": "advanced-flow-tab", "name": "Error Output", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 610, "y": 240, "wires": [] }, { "id": "debug-retrieve", "type": "debug", "z": "advanced-flow-tab", "name": "Retrieved Data", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 620, "y": 300, "wires": [] } ]