Hi, > Regarding parsing events stream, event names with spaces seem to be OK: > https://html.spec.whatwg.org/multipage/server-sent-events.html#parsing-an-event-stream
To me it feels quirky to separate the path and the type of the event by space. Personally I'd only report the type as "event:" and move the source path into the JSON data portion, or even omit it entirely. Considering the design of the client side API: eventSource.addEventListener(type, handler); Most use-cases probably want to register a handler for a specific event type, e.g. "status", and not N handlers to handle the different object path variations, so given the subscribe examples in the previous mail: eventSource.addEventListener("status", (ev) => { ... }) instead of eventSource.addEventListener("hostapd.wlan0 status", (ev) => { ... }) eventSource.addEventListener("hostapd.wlan0-1 status", (ev) => { ... }) eventSource.addEventListener("hostapd.wlan1 status", (ev) => { ... }) eventSource.addEventListener("hostapd.wlan1-1 status", (ev) => { ... }) Granted, one could use the `onmessage` event to implement a catch-all handler which is then filtering and dispatching according to the type, but even then string operations like split(), indexOf(), regex matches or similar would be required to match event types, that feels unelegant and not very performant. ~ Jo
signature.asc
Description: OpenPGP digital signature
_______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel