メインコンテンツまでスキップ

Lobby と WebSocket

Last updated on April 7, 2026

概要

AccelByte Gaming Services (AGS) WebSocket メッセージングプロトコルは、サーバー側での高速なオブジェクトとメッセージの変換とクライアント側でのシンプルさに焦点を当てたシンプルなメッセージングプロトコルです。このプロトコルは YAML データシリアライズ言語のサブセットです。

基本構造

このプロトコルでサポートされている構造は、文字列キーと値のオブジェクトです。キーと値はコロンの後にスペースで区切られます。オブジェクトは改行で区切られます。

keyA: [valueA1valueA2valueAn]\n
keyB: [valueB1valueB2valueBn]

各メッセージにはメッセージタイプを定義する type オブジェクトが必要です。

type:messageType\n
keyA:valueA\n
keyB:[valueB1,valueB2,valueBn,]

日時ベースの値は、秒フィールドまでの ISO-8601 日時で表す必要があります。

type:messageType\n
keyA:valueA\n
keyB:[valueB1,valueB2,valueBn,]\n
time:2018-11-09T03:51:18Z

メッセージタイプ

Lobby サーバーの実装には 3 種類のメッセージがあります。

リクエスト

リクエストメッセージは、クライアントからサーバーへのメッセージです。リクエストメッセージタイプには「-Request」サフィックスを付ける必要があります。リクエストメッセージにはクライアントによって生成されたオブジェクト ID が必要で、オブジェクト ID はオブジェクトタイプの後に配置する必要があります。各リクエストには、サーバーが同じオブジェクト ID で応答する必要があります。オブジェクトタイプはオブジェクトの先頭に配置する必要があります。

type:fooRequest\n
id:878a0f51bedd4825cf46827fd1478224\n
keyA:valueA\n
keyB:[valueB1,valueB2,valueBn,]

レスポンス

レスポンスメッセージは、クライアントのリクエストに対応するサーバーからクライアントへのメッセージです。レスポンスメッセージタイプには「-Response」サフィックスを付ける必要があり、レスポンスオブジェクト ID はリクエストに対応する必要があります。レスポンスにはレスポンスコードを識別するオブジェクトコードが必要です。成功したリクエストにはステータス 0 で応答する必要があります。失敗したリクエストには 0 以外のステータスコード(できればエラーイベント ID)で応答する必要があります。コードが 0 以外の場合、他のフィールドは無視する必要があります。

type:fooResponse\n
id:878a0f51bedd4825cf46827fd1478224\n
code:0\n
keyA:valueA\n
keyB:[valueB1,valueB2,valueBn,]

通知

通知は、ユーザーのリクエストなしにサーバーからクライアントに送信されるメッセージです。通知メッセージタイプには「-Notif」サフィックスを付ける必要があります。

type:fooNotif\n
keyA:valueA\n
keyB:[valueB1,valueB2,valueBn,]
注記

現在、PlayStation で既知の問題があります。以下の操作が発生すると、Lobby WebSocket 接続が非正常にクローズされます:

  • プレイヤーが PlayStation でゲームを開き、AccelByte Lobby WebSocket に接続します。
  • プレイヤーが PlayStation ホーム画面に移動して別のゲームを開きます。

Lobby WebSocket が切断され、AGS バックエンドは 3121 クローズコードで切断をログに記録します。

{
"Code": "3121",
"CodeName": "DisconnectReaderUnexpectedEOF",
"Text": "Disconnect WS due to server-side unexpected EOF",
"Attributes": [],
"Section": "disconnect with reconnect (reader)",
"Service": "lobby disconnect (with reconnect)"
}

Lobby サーバーの使用方法

フレンズ

コマンドリクエストペイロード非同期レスポンスペイロードUnrealUnity
フレンドリクエストtype: requestFriendsRequest\n id: message123\n friendId: user123type: requestFriendsResponse\n id: message123\n code: 0Lobby::RequestFriend(FString UserId)RequestFriend(string userId, ResultCallback callback)
公開 ID でフレンドリクエストtype: RequestFriendsByPublicID\nLobby::RequestFriendByPublicId(FString PublicId)RequestFriendByPublicId(string publicId, ResultCallback callback)
フレンドリクエスト通知type: requestFriendsNotif\n friendId: user123SetOnIncomingRequestFriendsNotifDelegate(const FRequestFriendsNotif& OnRequestFriendsNotif)OnIncomingFriendRequest
フレンド解除type: unfriendRequest\n id: message123\n friendId: user123type: unfriendResponse\n id: message123\n code: 0Lobby::Unfriend(FString UserId)Unfriend(string userId, ResultCallback callback)
フレンドリスト V2 リクエストtype: ListFriendsRequestV2\n id: message123N/AN/A
送信済みフレンドリクエスト一覧type: listOutgoingFriendsRequest\n id: message123type: listOutgoingFriendsResponse\n id: message123\n code: 0\n friendsId: [user123,user456,]\nLobby::ListOutgoingFriends()ListOutgoingFriends(ResultCallback<Friends> callback)
送信済みフレンドリクエストのキャンセルtype: cancelFriendsRequest\n id: message123\n friendId: user123type: cancelFriendsResponse\n id: message123\n code: 0Lobby::CancelFriendRequest(FString UserId)CancelFriendRequest(string userId, ResultCallback callback)
受信済みフレンドリクエスト一覧type: listIncomingFriendsRequest\n id: message123type: listIncomingFriendsResponse\n id: message123\n code: 0\n friendsId: [user123,user456,]Lobby::ListIncomingFriends()ListIncomingFriends(ResultCallback<Friends> callback)
タイムスタンプ付き受信フレンド一覧type: ListIncomingFriendsWithTimet\nLobby::ListIncomingFriendsWithTime()ListIncomingFriendsWithTime(ResultCallback<FriendsWithTimestamp> callback)
タイムスタンプ付き送信フレンド一覧type: ListOutgoingFriendsWithTimet\nLobby::ListOutgoingFriendsWithTime()ListOutgoingFriendsWithTime(ResultCallback<FriendsWithTimestamp> callback)
受信したフレンドリクエストを承認type: acceptFriendsRequest\n id: message123\n friendId: user123type: acceptFriendsResponse\n id: message123\n code: 0Lobby::AcceptFriend(FString UserId)AcceptFriend(string userId, ResultCallback callback)
フレンドリクエスト承認通知type: acceptFriendsNotif\n friendId: user123SetOnFriendRequestAcceptedNotifDelegate(const FAcceptFriendsNotif& OnAcceptFriendsNotif)FriendRequestAccepted
受信したフレンドリクエストを拒否type: rejectFriendsRequest\n id: message123\n friendId: user123type: rejectFriendsResponse\n id: message123\n code: 0Lobby::RejectFriend(FString UserId)RejectFriend(string userId, ResultCallback callback)
現在のフレンド一覧type: listOfFriendsRequest\n id: message123type: listOfFriendsResponse\n id: message123\n code: 0\n friendsId: [user123,user456,]Lobby::LoadFriendsList()LoadFriendsList(ResultCallback<Friends> callback)
フレンドシップ状態を取得type: getFriendshipStatusRequest\n id: message123\n friendId: user123type: getFriendshipStatusResponse id: message123 code: 0 friendshipStatus: 3Lobby::GetFriendshipStatus(FString UserId)GetFriendshipStatus(string userId, ResultCallback<FriendshipStatus> callback)
フレンド解除通知type: unfriendNotif\n friendId: user123SetOnUnfriendNotifDelegate(const FUnfriendNotif& OnUnfriendNotif)OnUnfriend
フレンドリクエストキャンセル通知type: cancelFriendsNotif\n userId: user123SetOnCancelFriendsNotifDelegate(const FCancelFriendsNotif& OnCancelFriendsNotif)FriendRequestCanceled
フレンドリクエスト拒否通知type: rejectFriendsNotif\n userId: user123SetOnRejectFriendsNotifDelegate(const FRejectFriendsNotif& OnRejectFriendsNotif)FriendRequestRejected

プレゼンス

コマンドリクエストペイロード非同期レスポンスペイロードUnrealUnityOSS
ユーザーステータスの設定type: setUserStatusRequest\n id: message123\n availability: 1\n activity: in party looking for memberstype: setUserStatusResponse\n id: message123\n code: 0Lobby::SendSetPresenceStatus(const EAvailability Availability , const FString& Activity)SetUserStatus(UserStatus status, string activity, ResultCallback callback)void FOnlinePresenceAccelByte::SetPresence(const FUniqueNetId& User, const FOnlineUserPresenceStatus& Status, const FOnPresenceTaskCompleteDelegate& Delegate)
ユーザーステータスの設定 v2type: setUserStatusRequestv2\nN/AN/A
ステータス通知type: userStatusNotif\n userID: 123\n availability: 1\n activity: idleSetUserPresenceNotifDelegate(FFriendStatusNotif OnUserPresenceNotif)FriendsStatusChangedOnPresenceReceived
すべてのフレンドのプレゼンス一覧type: friendsStatusRequest\n id: message123type: friendsStatusResponse\n id: message123\n code: 0\n friendsId: [uid1,uid2,uid3,]\n availability: [1,2,1,]\n activity: [playing mahjong ultra,null,in deathmatch shooter game,]\n lastSeenAt: [2018-09-30T06:42:57Z,2018-11-30T06:42:57Z,2018-10-21T06:42:57Z,]Lobby::SendGetOnlineFriendPresenceRequest()ListFriendsStatus(ResultCallback<FriendsStatus> callback)N/A

プレイヤーのブロック

コマンドリクエストペイロード非同期レスポンスペイロードUnrealUnity
プレイヤーをブロックtype: blockPlayerRequest\n id: message123\n userId: user123\n blockedUserId: user456\n namespace: sdktesttype: blockPlayerResponse\n id: message123\n code: 0\n namespace: ns\n blockedUserId: user123Lobby::BlockPlayer(const FString& UserId)BlockPlayer(string userId, ResultCallback<BlockPlayerResponse> callback)
ブロックされたプレイヤーを取得type: GetBlockedPlayer\n*REST API を使用*REST API を使用
プレイヤーブロック通知type: blockPlayerNotif userId: user123\n blockedUserId: user456\nSetBlockPlayerNotifDelegate(FBlockPlayerNotif OnBlockPlayerNotif)PlayerBlockedNotif
プレイヤーのブロック解除type: unblockPlayerRequest\n id: message123\n userId: user123\n unblockedUserId: user456\n namespace: nstype: unblockPlayerResponse\n id: friends-5358\n code: 0\n namespace: ns\n unblockedUserId: user456\nLobby::UnblockPlayer(const FString& UserId)UnblockPlayer(string userId, ResultCallback<UnblockPlayerResponse> callback)
プレイヤーブロック解除通知type: unblockPlayerNotif userId: user123\n unblockedUserId: user456\nSetUnblockPlayerNotifDelegate(FUnblockPlayerNotif OnUnblockPlayerNotif)PlayerUnblockedNotif

通知

通知の受信type: messageNotif\n subject: updateNotification\n from: system\n to: user123\n topic: 1111\n payload: message content 123\n sentAt: 2018-11-25T23:45:05ZSetMessageNotifDelegate(const FMessageNotif& OnNotificationMessage)OnNotification内部的にログを出力するためにのみ使用
BAN 通知の送信type: userBannedNotification\n id: message123\n code: 12002\n userId: user123\n ban: BAN-TYPE\n reason: BAN-REASON\n endDate: 2022-05-11 16:21:36.688 +0000 UTC\n enable: trueSetUserBannedNotificationDelegate(FUserBannedNotification OnUserBannedNotification)UserBannedNotificationN/A
BAN 解除通知の送信type: userUnbannedNotification\n id: message123\n code: 12002\n userId: user123\n ban: BAN-TYPE\n reason: BAN-REASON\n endDate: 2022-05-11 16:21:36.688 +0000 UTC\n enable: falseSetUserUnbannedNotificationDelegate(FUserUnbannedNotification OnUserUnbannedNotification)UserUnbannedNotificationN/A

シグナリング P2P

コマンドリクエストペイロード非同期レスポンスペイロードUnrealUnityOSS
シグナリングの送信type: signalingP2PNotif\n id: message123\n destinationId: user123\n message: message123type: signalingP2PNotif\n id: message123\n destinationId: user123\n message: message123Lobby::SendSignalingMessage(const FString& UserId, const FString& Message)SendSignalingMessage(string userId, string message)N/A

トークンの更新

コマンドリクエストペイロード非同期レスポンスペイロードUnrealUnity
トークンの更新type: refreshTokenRequest\n id: message123\n token: token123type: refreshTokenResponse\n id: message123\n code: 0Lobby::RefreshToken(const FString& AccessToken)RefreshToken( string newAccessToken, ResultCallback callback )

エラー通知

コマンドリクエストペイロード非同期レスポンスペイロードUnrealUnity
エラー通知type: errorNotif\n code: 429\n message: message123SetErrorNotifDelegate(FErrorNotif OnErrorNotif)ErrorNotification

次のトピック

次のステップは、マルチプレイヤー通知に関するより詳細なトピックを学ぶことです。