Edit

SSE_Send(server, data, [location])

Result type:  none

Definition:  Use this function to push SSE data to all clients connected to the HTTP server with Accept: text/event-stream. Server is the server handle from StartHTTPServer; data the data to push on the connection; optional location will only push the data to clients connected on that location, otherwise it is pushed to all clients connected to that server.

Example: 

Set up server for sending events to clients:

property server

on Load
    let server = StartHTTPServer("Handler", 7777) // start server
end    

// call this to send an event
on SendEvent
    SSE_Send(server, "data:Here is my event\n\n", "/events")
end

An external client might connect with:

$ curl --no-buffer --header "Accept: text/event-stream" "http://localhost:7777/events"
data:Here is my event

or, more likely, in javascript, with the EventSource API:

const evtSource = new EventSource("/events");
evtSource.onmessage = (event) => {
    // do something with  ${event.data}
    };

See Also:

GetHTTPRequest: Get the HTTP request when processing a REST request on the server

GetHTTPRequestHeaders: Get the HTTP request headers when processing a REST request on the server

GetHTTPRequestPayload: Get the POST payload of an HTTP or REST request

GetHTTPServerPort: Get port of an HTTP server

PutHTTPRequestResponse: Put additional response information for an HTTP request

StartHTTPServer: Start an HTTP server

StopHTTPServer: Stop an HTTP server