Roblox UtilitiesDevlHub Roblox Documentation

Class

WebStreamClient

NotCreatableNotReplicated
Inherits
Object
Memory category
Instances

Maintains a streaming connection.

Maintains a streaming connection. To process stream events as they arrive, connect callback functions to each event using RBXScriptSignal:Connect().

Properties 1#

ConnectionStateWebStreamClientStateThe current WebStreamClientState of the client.ReadSafeReadOnlyNotReplicated

ConnectionState: WebStreamClientState#

ReadOnlyNotReplicatedReadSafe

The current WebStreamClientState of the client.

Methods 2#

CloseCloses the client, aborting the ongoing request.
SendEnqueues data to be transmitted to the server over the streaming connection.

Close(): ()#

Closes the client, aborting the ongoing request. If successful, fires the WebStreamClient.Closed event.

Returns
  • ()

Send(data: string): ()#

Enqueues data to be transmitted to the server over the connection. Only works on clients created with WebStreamClientType.WebSocket. For other client types it does nothing.

NameTypeDefaultDescription
datastringText string to send to the server.
Returns
  • ()

Events 4#

ClosedFires when the streaming connection is closed, either by the server or by a call to WebStreamClient:Close().
ErrorFires if an error is received while establishing the connection or during the connection lifetime.
MessageReceivedFires each time a message is received from the server.
OpenedFires when the a connection is successfully established between the client and server, allowing for events to begin streaming.

Closed()#

Fires when the server closes the connection succesfully or the user calls WebStreamClient:Close()

Error(responseStatusCode: int, errorMessage: string)#

Fires if an error is received while establishing the connection or during the connection lifetime.

NameTypeDefaultDescription
responseStatusCodeintThe standard HTTP error status code (e.g., 404, 500).
errorMessagestringA descriptive message containing details about the error.

MessageReceived(message: string)#

Fires each time a message is received from the server. The format differs based on the WebStreamClientType.

NameTypeDefaultDescription
messagestringThe message data payload received from the server stream.

Opened(responseStatusCode: int, headers: string)#

Fires when the a connection is successfully established between the client and server, allowing for events to begin streaming. Provides any response headers in raw format, which can be used for validation.

NameTypeDefaultDescription
responseStatusCodeintThe standard HTTP success status code (e.g., 200).
headersstringThe raw HTTP response headers from the server.

Inherited members#

Inherited from Object 6
Properties (2)

ClassName, className

Events (1)

Changed