Strata is pre-1.0. APIs, protocol, and storage format may change.
strata_transport
Browser IO transport facade for Strata clients.
SendError
Section titled “SendError”Why a browser send did not happen.
pub type SendError { SocketNotOpen}Type aliases
Section titled “Type aliases”CloseEvent
Section titled “CloseEvent”A browser event for a WebSocket close or error.
pub type CloseEvent = browser.CloseEventSocket
Section titled “Socket”A browser WebSocket handle.
The browser owns the underlying connection.
pub type Socket = browser.SocketFunctions
Section titled “Functions”Start the browser WebSocket close operation.
pub fn close(browser.Socket) -> Nilopen_socket
Section titled “open_socket”Open a browser WebSocket and return its handle immediately.
The browser calls on_open when the connection opens. It calls
on_message only for text frames. It calls on_close for a close or error
event.
pub fn open_socket( String, fn(browser.Socket) -> Nil, fn(String) -> Nil, fn(browser.CloseEvent) -> Nil) -> browser.Socketrandom_replica_id
Section titled “random_replica_id”Create a local replica identifier.
Do not use this value as an authentication secret.
pub fn random_replica_id() -> Stringsend_text
Section titled “send_text”Send one text frame. Returns Error(SocketNotOpen) when the browser
socket is not open.
pub fn send_text( browser.Socket, String) -> Result(Nil, SendError)websocket_url
Section titled “websocket_url”Build a WebSocket URL with one encoded token query parameter.
Set secure to True to use wss. Set it to False to use ws.
pub fn websocket_url( host: String, port: Int, path: String, token: String, secure: Bool) -> String