GS2-InGamePushNotification¶
Create Client
in_game_push_notification_client = client('in-game-push-notification')
Method¶
create_certificate¶
response = in_game_push_notification_client:create_certificate(request)
if response.isError then
-- エラー処理 --
print(response.statusCode)
print(response.errorMessage)
else
-- 正常処理 --
print(response.result)
end
クライアント証明書を新規作成します
MQTTサーバに接続するためのクライアント証明書の発行を行います。 1ユーザに対して発行できるクライアント証明書は同時に1つのみです。 異なるデバイスでMQTTサーバにアクセスする場合、クライアント証明書を削除して取り直すようにしてください。
- 消費クオータ: 10
Request¶
{
gameName=string,
accessToken=string
}
- gameName
- [string] ゲームの名前
- accessToken
- [string] GS2-Auth で発行を受けたアクセストークン
create_game¶
response = in_game_push_notification_client:create_game(request)
if response.isError then
-- エラー処理 --
print(response.statusCode)
print(response.errorMessage)
else
-- 正常処理 --
print(response.result)
end
ゲームを新規作成します
GS2-InGamePushNotification の使用を開始するには、まずはゲームを作成します。 その後、ゲームに対してMQTTに接続するためのクライアント証明書の発行を依頼をします。 応答されたクライアント証明書と秘密鍵をデバイスに保存し、MQTTサーバへの接続に使用します。
サーバサイドから ユーザに対してプッシュ通知を出すことが出来ます。 その際にユーザがMQTTに接続している場合はMQTTを使用して通知を出します。 もし、ユーザがMQTTに接続していない場合の挙動は ゲームの設定で変更できます。
1つ目は何もしない。 2つ目は指定したURLに通知する。 3つ目は Firebase Cloud Messaging を使用してモバイルプッシュ通知する。です。
http/https を指定した場合、以下のフォーマットでURLにPOSTします。 {
"_gs2_service": "gs2-in-game-push-notification", "userId": ユーザID "subject": サブジェクト, "body": ボディ,
}
APIリクエスト以外に各デバイスがMQTTサーバに新しく接続する際に クオータを10消費する点にご注意ください。
Request¶
{
serviceClass=string,
notificationFirebaseServerKey=string,
name=string,
notificationUrl=string,
offlineTransfer=string,
description=string,
}
- serviceClass
- [string] サービスクラス
- notificationFirebaseServerKey
- [string] Firebaseのサーバーキー
- name
- [string] ゲーム名
- notificationUrl
- [string] オフライン転送先URL
- offlineTransfer
- [string] オフライン転送方式
- description
- [string] 説明文
delete_certificate¶
response = in_game_push_notification_client:delete_certificate(request)
if response.isError then
-- エラー処理 --
print(response.statusCode)
print(response.errorMessage)
else
-- 正常処理 --
print(response.result)
end
クライアント証明書を削除します。
- 消費クオータ: 10
Request¶
{
gameName=string,
accessToken=string
}
- gameName
- [string] ゲームの名前
- accessToken
- [string] GS2-Auth で発行を受けたアクセストークン
Response¶
None
delete_game¶
response = in_game_push_notification_client:delete_game(request)
if response.isError then
-- エラー処理 --
print(response.statusCode)
print(response.errorMessage)
else
-- 正常処理 --
print(response.result)
end
ゲームを削除します
Response¶
None
describe_game¶
response = in_game_push_notification_client:describe_game(request)
if response.isError then
-- エラー処理 --
print(response.statusCode)
print(response.errorMessage)
else
-- 正常処理 --
print(response.result)
end
ゲームの一覧を取得します
Request¶
{
pageToken=string,
limit=number,
}
- pageToken
- [string] データの取得を開始する位置を指定するトークン
- limit
- [number] データの取得件数
describe_service_class¶
response = in_game_push_notification_client:describe_service_class(request)
if response.isError then
-- エラー処理 --
print(response.statusCode)
print(response.errorMessage)
else
-- 正常処理 --
print(response.result)
end
サービスクラスの一覧を取得します
Request¶
{
}
describe_status¶
response = in_game_push_notification_client:describe_status(request)
if response.isError then
-- エラー処理 --
print(response.statusCode)
print(response.errorMessage)
else
-- 正常処理 --
print(response.result)
end
ユーザステータスの一覧を取得します
Request¶
{
gameName=string,
pageToken=string,
limit=number,
}
- gameName
- [string] ゲームの名前
- pageToken
- [string] データの取得を開始する位置を指定するトークン
- limit
- [number] データの取得件数
get_game¶
response = in_game_push_notification_client:get_game(request)
if response.isError then
-- エラー処理 --
print(response.statusCode)
print(response.errorMessage)
else
-- 正常処理 --
print(response.result)
end
ゲームを取得します
get_game_status¶
response = in_game_push_notification_client:get_game_status(request)
if response.isError then
-- エラー処理 --
print(response.statusCode)
print(response.errorMessage)
else
-- 正常処理 --
print(response.result)
end
ゲームの状態を取得します
get_mqtt_host¶
response = in_game_push_notification_client:get_mqtt_host(request)
if response.isError then
-- エラー処理 --
print(response.statusCode)
print(response.errorMessage)
else
-- 正常処理 --
print(response.result)
end
MQTTサーバ情報を取得します
Request¶
{
gameName=string,
accessToken=string
}
- gameName
- [string] ゲームの名前
- accessToken
- [string] GS2-Auth で発行を受けたアクセストークン
get_web_socket_host¶
response = in_game_push_notification_client:get_web_socket_host(request)
if response.isError then
-- エラー処理 --
print(response.statusCode)
print(response.errorMessage)
else
-- 正常処理 --
print(response.result)
end
MQTT over Websocketサーバ情報を取得します
Request¶
{
gameName=string,
accessToken=string
}
- gameName
- [string] ゲームの名前
- accessToken
- [string] GS2-Auth で発行を受けたアクセストークン
publish¶
response = in_game_push_notification_client:publish(request)
if response.isError then
-- エラー処理 --
print(response.statusCode)
print(response.errorMessage)
else
-- 正常処理 --
print(response.result)
end
通知を送信します。
- 消費クオータ: 3
Request¶
{
gameName=string,
userId=string,
body=string,
enableOfflineTransfer=boolean,
offlineTransferSound=string,
subject=string,
}
- gameName
- [string] ゲームの名前
- userId
- [string] 通知の送信先ユーザID
- body
- [string] 本文
- enableOfflineTransfer
- [boolean] 対象ユーザがオフラインの場合に転送を実行するか
- offlineTransferSound
- [string] Firebaseへの転送時に使用する通知音ファイル名
- subject
- [string] 件名
set_firebase_token¶
response = in_game_push_notification_client:set_firebase_token(request)
if response.isError then
-- エラー処理 --
print(response.statusCode)
print(response.errorMessage)
else
-- 正常処理 --
print(response.result)
end
Firebase のデバイストークンを設定します。
- 消費クオータ: 10
Request¶
{
gameName=string,
token=string,
accessToken=string
}
- gameName
- [string] ゲームの名前
- token
- [string] デバイストークン
- accessToken
- [string] GS2-Auth で発行を受けたアクセストークン
update_game¶
response = in_game_push_notification_client:update_game(request)
if response.isError then
-- エラー処理 --
print(response.statusCode)
print(response.errorMessage)
else
-- 正常処理 --
print(response.result)
end
ゲームを更新します
Request¶
{
gameName=string,
notificationUrl=string,
serviceClass=string,
notificationFirebaseServerKey=string,
offlineTransfer=string,
description=string,
}
- gameName
- [string] ゲームの名前
- notificationUrl
- [string] オフライン転送先URL
- serviceClass
- [string] サービスクラス
- notificationFirebaseServerKey
- [string] Firebaseのサーバーキー
- offlineTransfer
- [string] オフライン転送方式
- description
- [string] 説明文
Model¶
Status¶
- status
- [string] ステータス
- createAt
- [number] 登録日時
- userId
- [string] ユーザID
- fcmToken
- [string] Firebaseトークン
Game¶
- gameId
- [string] ゲームID
- name
- [string] ゲーム名
- description
- [string] 説明文
- serviceClass
- [string] サービスクラス
- createAt
- [number] 作成日時(エポック秒)
- notificationUrl
- [string] http/https を選択した際の転送先URL
- ownerId
- [string] オーナーID
- updateAt
- [number] 最終更新日時(エポック秒)
- offlineTransfer
- [string] 対象がオフライン時使用する転送方式
- notificationFirebaseServerKey
- [string] fcm を選択した際の Firebase サーバーキー
Certificate¶
- pfx
- [string] PFXフォーマットの秘密鍵
- certificateId
- [string] 証明書ID
- privateKey
- [string] 秘密鍵
- certificate
- [string] クライアント証明書