Class
WebStreamClient
NotCreatableNotReplicated
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#
ConnectionStateWebStreamClientState | The current WebStreamClientState of the client.ReadSafeReadOnlyNotReplicated |
ConnectionState: WebStreamClientState#
ReadOnlyNotReplicatedReadSafe
The current WebStreamClientState of the client.
Methods 2#
| Close | Closes the client, aborting the ongoing request. |
| Send | Enqueues 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.
| Name | Type | Default | Description |
|---|---|---|---|
data | string | Text string to send to the server. |
Returns
()
Events 4#
| Closed | Fires when the streaming connection is closed, either by the server or by
a call to WebStreamClient:Close(). |
| Error | Fires if an error is received while establishing the connection or during the connection lifetime. |
| MessageReceived | Fires each time a message is received from the server. |
| Opened | Fires 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.
| Name | Type | Default | Description |
|---|---|---|---|
responseStatusCode | int | The standard HTTP error status code (e.g., 404, 500). | |
errorMessage | string | A 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.
| Name | Type | Default | Description |
|---|---|---|---|
message | string | The 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.
| Name | Type | Default | Description |
|---|---|---|---|
responseStatusCode | int | The standard HTTP success status code (e.g., 200). | |
headers | string | The raw HTTP response headers from the server. |