GS2-Chat Script Trigger Reference

Reference of event triggers that call extended scripts

Trigger

createRoom

Room creation

Synchronous Execution Script

The script is executed synchronously before the room creation process.

Request
TypeDescription
namespaceNamespaceNamespace
roomRoomRoom
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow room creation
Implementation Example
-- Request
local namespace = args.namespace
local room = args.room

-- Business logic:
local permit = true

-- Result
result = {
  permit=permit
}

Asynchronous Execution Script

The script is executed asynchronously after the room creation process.

Request
TypeDescription
namespaceNamespaceNamespace
roomRoomRoom
Implementation Example
-- Request
local namespace = args.namespace
local room = args.room

-- Asynchronous scripts typically do not affect the API response.
-- Use for logging, analytics, external notifications, etc.

result = {
}

deleteRoom

Room deletion

Synchronous Execution Script

The script is executed synchronously before the room deletion process.

Request
TypeDescription
namespaceNamespaceNamespace
roomRoomRoom
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow room deletion
Implementation Example
-- Request
local namespace = args.namespace
local room = args.room

-- Business logic:
local permit = true

-- Result
result = {
  permit=permit
}

Asynchronous Execution Script

The script is executed asynchronously after the room deletion process.

Request
TypeDescription
namespaceNamespaceNamespace
roomRoomRoom
Implementation Example
-- Request
local namespace = args.namespace
local room = args.room

-- Asynchronous scripts typically do not affect the API response.
-- Use for logging, analytics, external notifications, etc.

result = {
}

postMessage

Message posting

Synchronous Execution Script

The script is executed synchronously before the message posting process.

Request
TypeDescription
namespaceNamespaceNamespace
roomRoomRoom
messageMessageMessage
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow message posting
Implementation Example
-- Request
local namespace = args.namespace
local room = args.room
local message = args.message

-- Business logic:
local permit = true

-- Result
result = {
  permit=permit
}

Asynchronous Execution Script

The script is executed asynchronously after the message posting process.

Request
TypeDescription
namespaceNamespaceNamespace
roomRoomRoom
messageMessageMessage
Implementation Example
-- Request
local namespace = args.namespace
local room = args.room
local message = args.message

-- Asynchronous scripts typically do not affect the API response.
-- Use for logging, analytics, external notifications, etc.

result = {
}

subscribeRoom

Room subscription

Synchronous Execution Script

The script is executed synchronously before the room subscription process.

Request
TypeDescription
namespaceNamespaceNamespace
roomRoomRoom
subscribeSubscribeSubscribe
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow room subscription
Implementation Example
-- Request
local namespace = args.namespace
local room = args.room
local subscribe = args.subscribe

-- Business logic:
local permit = true

-- Result
result = {
  permit=permit
}

Asynchronous Execution Script

The script is executed asynchronously after the room subscription process.

Request
TypeDescription
namespaceNamespaceNamespace
roomRoomRoom
subscribeSubscribeSubscribe
Implementation Example
-- Request
local namespace = args.namespace
local room = args.room
local subscribe = args.subscribe

-- Asynchronous scripts typically do not affect the API response.
-- Use for logging, analytics, external notifications, etc.

result = {
}

unsubscribeRoom

Room unsubscription

Synchronous Execution Script

The script is executed synchronously before the room unsubscription process.

Request
TypeDescription
namespaceNamespaceNamespace
roomRoomRoom
subscribeSubscribeSubscribe
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow room unsubscription
Implementation Example
-- Request
local namespace = args.namespace
local room = args.room
local subscribe = args.subscribe

-- Business logic:
local permit = true

-- Result
result = {
  permit=permit
}

Asynchronous Execution Script

The script is executed asynchronously after the room unsubscription process.

Request
TypeDescription
namespaceNamespaceNamespace
roomRoomRoom
subscribeSubscribeSubscribe
Implementation Example
-- Request
local namespace = args.namespace
local room = args.room
local subscribe = args.subscribe

-- Asynchronous scripts typically do not affect the API response.
-- Use for logging, analytics, external notifications, etc.

result = {
}