| 69 | * Leitung offen bleibt) und ergeben nichts. |
| 70 | */ |
| 71 | export function parseSseFrame(raw: string): SseFrame | undefined { |
| 72 | let name = 'message'; |
| 73 | const data: string[] = []; |
| 74 | for (const line of raw.split('\n')) { |
| 75 | if (line.startsWith(':') || line.length === 0) { |
| 76 | continue; |
| 77 | } |
| 78 | if (line.startsWith('event:')) { |
| 79 | name = line.slice(6).trim(); |
| 80 | continue; |
| 81 | } |
| 82 | if (line.startsWith('data:')) { |
| 83 | data.push(line.slice(5).trimStart()); |
| 84 | } |
| 85 | } |
| 86 | return data.length === 0 ? undefined : { event: name, data: data.join('\n') }; |
| 87 | } |
| 88 | |
| 89 | /** Der aktuelle Daemon-Port; ein alter agents-Parameter hat keine Wirkung. */ |
| 90 | export function bridgePortFromSearch(_search: string): number { |