SNetwork
Index
Functions Index
void SendNetworkMessage (string key, Table message, bool serverOnly, bool loopback) void SendNetworkMessage (string key, Table message, bool serverOnly) void SendNetworkMessage (string key, Table message)
void SendNetworkMessageToUser (string key, Table message, uint userID)
void SubscribeToRegionPropertyUpdate (string key, DynValue onRecieve)
void SubscribeToNetwork (string key, DynValue onRecieve)
void SetRegionProperty (string key, string value)
string GetRegionProperty (string key)
void SetShardProperty (string key, string value)
string GetShardProperty (string key)
Properties Index
bool HasShardProperties get
Returns True upon successful connection to the Region/Shard properties' storage. Region/Shard property operations may not be ready when used during initialization and this function will help determine readiness.
Overview
Local network messages (region/shard scope)
Use SendNetworkMessage / SubscribeToNetwork with a string key.
Delivery is confined to the current region or shard and only to active subscribers of that key.
Payload is a Lua Table (dictionary) of network-serializable types. Messages are ephemeral and not stored.
Region/Shard properties (server-stored)
Use SetRegionProperty/GetRegionProperty for region-scoped semi-permanent storage (persists while the region is open).
Use SetShardProperty/GetShardProperty for shard-scoped storage (persists until the shard shuts down or all users leave).
Values are strings; operations may be rate-limited and may not be immediately available on join. Use HasShardProperties to detect readiness.
Functions
SendNetworkMessage
void SendNetworkMessage (string key, Table message)
void SendNetworkMessage (string key, Table message, bool serverOnly)
void SendNetworkMessage (string key, Table message, bool serverOnly, bool loopback)
Sends a networked message to every client with a subscriber listening on 'key'. The message itself can be a table/dictionary of network-serializable types (string, float, int, byte, bool and arrays of those types). Requests may be rate limited.
key
string
Subscription key to route the message to listeners
message
Table
Table/dictionary of serializable values
serverOnly
bool
Optional. If true, send via server only
loopback
bool
Optional. If true, also invoke local subscriber on this client
SendNetworkMessageToUser
void SendNetworkMessageToUser (string key, Table message, uint userID)
Sends a networked message to a specific user (userID) with a subscriber listening on 'key'.
key
string
Subscription key
message
Table
Table/dictionary of serializable values
userID
uint
Target user ID
SubscribeToRegionPropertyUpdate
void SubscribeToRegionPropertyUpdate (string key, DynValue onRecieve)
Subscribes to region property updates on 'key'.
key
string
Property key to subscribe to
onRecieve
Callback Closure
onRecieve(NetworkPropertyUpdate) will be called on updates. NetworkPropertyUpdate = { Key, Message }
SubscribeToNetwork
void SubscribeToNetwork (string key, Action< SNetworkMessageLua > onRecieve) void SubscribeToNetwork (string key, DynValue onRecieve)
Subscribes to network messages on 'key', will fire a SNetworkMessage whenever a matching message is received
key
string
Subscription key to listen on
onRecieve
Callback Closure
Callback receiving SNetworkMessageLua with fields Key (string) and Message (Table)
SetRegionProperty
void SetRegionProperty (string key, string value)
Stores a key/value pair in the Regions semi-permanent memory. Will be erased when all players exit the region, but will persist as long as the region is open. Subject to rate limiting (10/second on the main grid and 20/second on white-label grids)
GetRegionProperty
string GetRegionProperty (string key)
Retrieves the last set value for 'key' in this region. If you have just joined the region, this may not be populated immedietely.
SetShardProperty
void SetShardProperty (string key, string value)
Sets a property named 'key' of the Shard to 'value'. Will persist until the Shard is shut down or restarted. (Use SPersistence for longer term storage)
GetShardProperty
string GetShardProperty (string key)
Gets a previously set key.
Properties
HasShardProperties
bool HasShardProperties get
Returns True upon successful connection to the Region/Shard properties' storage. Region/Shard property operations may not be ready when used during initialization and this function ill help determine readiness.
Last updated
Was this helpful?

