WebTransport
public abstract class WebTransportNamespace Flux.
The host side of System.Net.Http.HttpClient and System.Net.WebSockets.ClientWebSocket: the API of the program's host sets Current before any script runs (NodeWorld.Flux for worlds: every address goes through the network gate of the client). Without one, a request throws PlatformNotSupportedException. Not for scripts. The answers come back on the scripts' thread, through the receiver given with the request.
Properties
Current
public static WebTransport? Current { get; set; }The transport of this program, set by its host before any script runs; null: no web (a request throws PlatformNotSupportedException).
Methods
Send
public abstract int Send(WebRequestData request, IWebReceiver receiver)Starts an HTTP request; returns its id (for Cancel).
Cancel
public abstract void Cancel(int id)The request stops; its receiver hears nothing more.
Connect
public abstract int Connect(string url, IList<string> subProtocols, IList<KeyValuePair<string, string>> headers, int keepAliveMilliseconds, IWebReceiver receiver)Opens a WebSocket (ws, wss); returns its id.
SendMessage
public abstract void SendMessage(int id, int messageType, bool endOfMessage, ReadOnlySpan<byte> data)Sends a message (or a piece of one) on a socket: 0 text, 1 binary.
Close
public abstract void Close(int id, int status, string? description)Sends the close frame (status -1: none).
Abort
public abstract void Abort(int id)Closes at once, without the close handshake; its receiver hears nothing more.
