Repository navigation
Expand file tree
/
Copy pathwebsocket.json
More file actions
164 lines (164 loc) · 5.08 KB
/
Copy pathwebsocket.json
File metadata and controls
164 lines (164 loc) · 5.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
[
{
"id": "94f237d7e5864fc4",
"type": "tab",
"label": "Responses WebSocket Example",
"disabled": false,
"info": "Responses websocket example.\n\nThis flow demonstrates the websocket lifecycle through one `OpenAI API` node instance:\n- connect the websocket\n- send a `response.create` client event\n- inspect streamed server events from the same node\n- close the connection cleanly",
"env": []
},
{
"id": "7d097a8ea8f89f3b",
"type": "comment",
"z": "94f237d7e5864fc4",
"name": "Configure the red-marked node, then use the same OpenAI API node for connect, send, and close.",
"info": "Before running:\n- import the flow, then configure the red-marked `OpenAI API` node with your own `Service Host`\n- this example stores websocket commands in `msg.ai` because the `OpenAI API` node property is configured to `ai`\n- if your node uses the default property, move the same fields under `msg.payload`\n\nImportant:\n- the websocket connection lives inside a single `OpenAI API` node instance\n- for that reason, connect, send, and close all target the same node\n- click `Connect Responses WebSocket` first, then `Send response.create Event`, then `Close Responses WebSocket`",
"x": 480,
"y": 140,
"wires": []
},
{
"id": "9c6d8525af6b0e2a",
"type": "comment",
"z": "94f237d7e5864fc4",
"name": "What comes out of the node?",
"info": "This node produces two kinds of output:\n- immediate local acknowledgements for `connect`, `send`, and `close`\n- asynchronous Responses server events such as `response.created`, `response.in_progress`, `response.output_text.delta`, and `response.completed`\n\nServer events arrive in `msg.payload` and include connection metadata under `msg.openai`.",
"x": 410,
"y": 220,
"wires": []
},
{
"id": "b4a7fef11decb00a",
"type": "inject",
"z": "94f237d7e5864fc4",
"name": "Connect Responses WebSocket",
"props": [
{
"p": "ai.action",
"v": "connect",
"vt": "str"
},
{
"p": "ai.connection_id",
"v": "demo-connection-1",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 250,
"y": 320,
"wires": [
[
"2f33fb2b774e1f8f"
]
]
},
{
"id": "db2a19cffba6f2d1",
"type": "inject",
"z": "94f237d7e5864fc4",
"name": "Send response.create Event",
"props": [
{
"p": "ai.action",
"v": "send",
"vt": "str"
},
{
"p": "ai.connection_id",
"v": "demo-connection-1",
"vt": "str"
},
{
"p": "ai.event",
"v": "{\"type\":\"response.create\",\"model\":\"gpt-5.4-nano-2026-03-17\",\"input\":\"Say hello from Responses websocket mode in one sentence.\"}",
"vt": "json"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 230,
"y": 400,
"wires": [
[
"2f33fb2b774e1f8f"
]
]
},
{
"id": "22f0c821e335fcbc",
"type": "inject",
"z": "94f237d7e5864fc4",
"name": "Close Responses WebSocket",
"props": [
{
"p": "ai.action",
"v": "close",
"vt": "str"
},
{
"p": "ai.connection_id",
"v": "demo-connection-1",
"vt": "str"
},
{
"p": "ai.reason",
"v": "Example flow complete",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 240,
"y": 480,
"wires": [
[
"2f33fb2b774e1f8f"
]
]
},
{
"id": "2f33fb2b774e1f8f",
"type": "OpenAI API",
"z": "94f237d7e5864fc4",
"name": "Manage Model Response WebSocket",
"property": "ai",
"propertyType": "msg",
"service": "",
"method": "manageModelResponseWebSocket",
"x": 600,
"y": 400,
"wires": [
[
"5260c60b85f63c44"
]
]
},
{
"id": "5260c60b85f63c44",
"type": "debug",
"z": "94f237d7e5864fc4",
"name": "Responses WebSocket",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 860,
"y": 400,
"wires": []
}
]