Trigger Reference of GS2-Chat Script

createRoom

Event trigger to call GS2-Script before a room is created.

Request

TypeDescription
namespaceNamespaceNamespace
roomRoomRoom

Result

TypeRequireDefaultLimitationDescription
permitboolAllow room creation?

Implementation Example

namespace = args.namespace
room = args.room

result = {
  permit=permit
}

createRoomDone

GS2-Script called after a room is created.

Request

TypeDescription
namespaceNamespaceNamespace
roomRoomRoom

Result

TypeRequireDefaultLimitationDescription

Implementation Example

namespace = args.namespace
room = args.room

result = {
}

deleteRoom

Event trigger to call GS2-Script before a room is deleted.

Request

TypeDescription
namespaceNamespaceNamespace
roomRoomRoom

Result

TypeRequireDefaultLimitationDescription
permitboolAllow room deletion or

Implementation Example

namespace = args.namespace
room = args.room

result = {
  permit=permit
}

deleteRoomDone

GS2-Script called after a room is deleted.

Request

TypeDescription
namespaceNamespaceNamespace
roomRoomRoom

Result

TypeRequireDefaultLimitationDescription

Implementation Example

namespace = args.namespace
room = args.room

result = {
}

postMessage

Event trigger to call GS2-Script before posting a message.

Request

TypeDescription
namespaceNamespaceNamespace
roomRoomRoom
messageMessageMessage

Result

TypeRequireDefaultLimitationDescription
permitboolAllow message posting or

Implementation Example

namespace = args.namespace
room = args.room
message = args.message

result = {
  permit=permit
}

postMessageDone

GS2-Script called after posting a message.

Request

TypeDescription
namespaceNamespaceNamespace
roomRoomRoom
messageMessageMessage

Result

TypeRequireDefaultLimitationDescription

Implementation Example

namespace = args.namespace
room = args.room
message = args.message

result = {
}

subscribeRoom

Event trigger to call GS2-Script before subscribing to a room.

Request

TypeDescription
namespaceNamespaceNamespace
roomRoomRoom
subscribeSubscribeSubscribe

Result

TypeRequireDefaultLimitationDescription
permitboolAllow room subscription

Implementation Example

namespace = args.namespace
room = args.room
subscribe = args.subscribe

result = {
  permit=permit
}

subscribeRoomDone

GS2-Script called after subscribing to a room.

Request

TypeDescription
namespaceNamespaceNamespace
roomRoomRoom
subscribeSubscribeSubscribe

Result

TypeRequireDefaultLimitationDescription

Implementation Example

namespace = args.namespace
room = args.room
subscribe = args.subscribe

result = {
}

unsubscribeRoom

Event trigger to call GS2-Script before room subscription is cancelled.

Request

TypeDescription
namespaceNamespaceNamespace
roomRoomRoom
subscribeSubscribeSubscribe

Result

TypeRequireDefaultLimitationDescription
permitboolAllow room unsubscription

Implementation Example

namespace = args.namespace
room = args.room
subscribe = args.subscribe

result = {
  permit=permit
}

unsubscribeRoomDone

GS2-Script called after room subscription is cancelled.

Request

TypeDescription
namespaceNamespaceNamespace
roomRoomRoom
subscribeSubscribeSubscribe

Result

TypeRequireDefaultLimitationDescription

Implementation Example

namespace = args.namespace
room = args.room
subscribe = args.subscribe

result = {
}