Primitives / Network
foldkit-primitives/net
What the network reported last: whether the browser is online, the state of a socket or an event stream, a post from another tab. Connection state lives in the Model; a payload only notifies, and the parent keeps what it wants of it. (source)
| Name | Form | Model | Messages | Args |
|---|---|---|---|---|
Online | bundle | { online } | Changed { online } | none |
websocket({ name, createSocket? }) | bundle factory | { url, status, lastError, opened } | Connecting, Opened, Received { data }, Sent { data }, SendFailed, Closed, Failed, TimedOut | { url, connectTimeoutMs? } |
sse({ name, createSource? }) | bundle factory | { url, status, lastError } | Connecting, Opened, Received { data }, Closed, Failed | { url } |
broadcastMessages(name) | entry | Received { data } | ||
postBroadcast(name, data) | Command | Posted, BroadcastFailed | ||
SharedHost.define({ name, opening }) | plain functions |