Component:WebsocketClient

From Resonite Wiki
Revision as of 04:16, 20 November 2023 by Ohzee (talk | contribs) (Removed irrelevant names and adjusted image)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Fields

Fields
Name Type Description
persistent Bool Determines whether or not this item will be saved to the server.
UpdateOrder Int Controls the order in which this component is updated.
Enabled Bool Controls whether or not this component is enabled.
URL Uri The Websocket server to target - either secure (wss://) or insecure (ws://)
User User The user who will be responsible for establishing the connection, and transmitting data.
_machineId String Automatically Assigned - The machineId of User
_userId String Automatically Assigned - The userId of User
AccessReason String A descriptive string explaining why this connection request should be granted
ConnectRetryInterval Float How often to retry the connection, if it fails for reasons other than being rejected by the user.
IsConnected Bool A read-only value indicating if this client has successfully connected to the target specified in URL

Usage

This component must be used in conjunction with the Websocket Protoflux Nodes - it only exists to store state, and does not function on its own.

User should be a user that expects to be hosting the Websocket connection Assignments should generally be made in the following order, depending on which one is the most applicable:

  • The user wearing the avatar containing this Protoflux
  • A specifically defined user who is expected to be present for this connection to function
  • The user who spawned the object containing this Protoflux
  • The user who is currently interacting with the object
  • The host of the session

You should not select a user who is not expecting the object to connect to an external service. It is possible they will deny the connection (especially if AccessReason isn't sufficiently convincing), which will cause the connection to fail.

AccessReason should provide a clear and concise reason for wanting to connect to the external service - It should include an obvious title or description of the object that is attempting to establish the connection, so that the user is aware of what item in the world is prompting the connection.

The object should have some way of indicating that it did not successfully connect to the target service, and that it will not function as intended, if at all.

The websocket times out and disconnects if the remote server does not send any traffic (including heartbeat messages) at least every 60 seconds, for long running connections be sure to configure the keepalive interval on the server side.

Examples

Related Issues

Related Components