net.patch
| new/src/com/goldencode/p2j/ui/client/driver/web/res/p2j.network_socket.js 2025-09-22 13:19:34 +0000 | ||
|---|---|---|
| 7 | 7 |
** -#- -I- --Date-- ------------------------------Description---------------------------------- |
| 8 | 8 |
** 001 PMP 20250916 Created initial version. |
| 9 | 9 |
** PMP 20250917 Replaced fragile string replacement with URL object for socket endpoint. |
| 10 |
** PMP 20250922 Ensured full cleanup by detaching handlers before closing the websocket. |
|
| 10 |
** PMP 20250922 Ensured full cleanup by detaching handlers before closing the websocket, |
|
| 11 |
** into the onclose handler. |
|
| 11 | 12 |
*/ |
| 12 | 13 |
/* |
| 13 | 14 |
** This program is free software: you can redistribute it and/or modify |
| ... | ... | |
| 167 | 168 | |
| 168 | 169 |
netSocket.onclose = (event) => |
| 169 | 170 |
{
|
| 170 |
console.log("WebSocket closed. Reason = " + event.reason);
|
|
| 171 |
console.log("WebSocket closed.", event);
|
|
| 171 | 172 |
// If the websocket closed unexpectedly, abort the test with error message. |
| 172 | 173 |
p2j.perfTests.notifyClosing(); |
| 174 | ||
| 175 |
//cleanup |
|
| 176 |
netSocket.onopen = null; |
|
| 177 |
netSocket.onmessage = null; |
|
| 178 |
netSocket.onerror = null; |
|
| 179 |
netSocket.onclose = null; |
|
| 180 |
netSocket = null; |
|
| 173 | 181 |
}; |
| 174 | 182 | |
| 175 | 183 | |
| ... | ... | |
| 187 | 195 |
{
|
| 188 | 196 |
if (netSocket) |
| 189 | 197 |
{
|
| 198 |
console.log("Closing network websocket...");
|
|
| 190 | 199 |
netSocket.close(); |
| 191 |
console.log("Closing network websocket...");
|
|
| 192 |
netSocket.onopen = null; |
|
| 193 |
netSocket.onmessage = null; |
|
| 194 |
netSocket.onerror = null; |
|
| 195 |
netSocket.onclose = null; |
|
| 196 |
netSocket = null; |
|
| 197 | 200 |
} |
| 198 | 201 |
}; |
| 199 | 202 | |