The OpenD Programming Language

EventSourceServer.sendEvent

Sends an event to the event server, starting it if necessary. The event server will distribute it to any listening clients, and store it for lifetime seconds for any later listening clients to catch up later.

interface EventSourceServer
static
void
sendEvent
(
string url
,
string event
,
string data
,)

Parameters

url string

A string identifying this event "bucket". Listening clients must also connect to this same string. I called it url because I envision it being just passed as the url of the request.

event string

the event type string, which is used in the Javascript addEventListener API on EventSource

data string

the event data. Available in JS as event.data.

lifetime int

the amount of time to keep this event for replaying on the event server.

Bugs

Not implemented on Windows!

Meta

History

Officially stabilised on November 23, 2023 (dub v11.4). It actually worked pretty well in its original design.