diff --git a/Assets/Talo Game Services/Talo/Runtime/APIs/PlayersAPI.cs b/Assets/Talo Game Services/Talo/Runtime/APIs/PlayersAPI.cs index 6b3d100..d7dab0b 100644 --- a/Assets/Talo Game Services/Talo/Runtime/APIs/PlayersAPI.cs +++ b/Assets/Talo Game Services/Talo/Runtime/APIs/PlayersAPI.cs @@ -50,7 +50,7 @@ public void InvokeIdentifiedEvent() private async Task HandleIdentifySuccess(PlayerAlias alias, string socketToken = "") { - if (!Talo.IsOffline()) + if (!Talo.IsOffline() && Talo.Socket.IsIdentified()) { await Talo.Socket.ResetConnection(); } diff --git a/Assets/Talo Game Services/Talo/Runtime/TaloSocket.cs b/Assets/Talo Game Services/Talo/Runtime/TaloSocket.cs index d2b8b8b..9743ada 100644 --- a/Assets/Talo Game Services/Talo/Runtime/TaloSocket.cs +++ b/Assets/Talo Game Services/Talo/Runtime/TaloSocket.cs @@ -19,6 +19,12 @@ public class TaloSocket : MonoBehaviour private void Awake() { socket = gameObject.AddComponent(); + socket.DesiredConfig = new WebSocketConfig + { + PingInterval = TimeSpan.FromSeconds(30), + PingMessage = new WebSocketMessage("v1.heartbeat") + }; + socket.MessageReceived += HandleMessage; socket.StateChanged += HandleStateChange; } @@ -139,5 +145,10 @@ public async Task ResetConnection() await OpenConnection(); } } + + public bool IsIdentified() + { + return identified; + } } } diff --git a/Assets/Talo Game Services/Talo/Runtime/Vendor/com.mikeschweitzer.websocket b/Assets/Talo Game Services/Talo/Runtime/Vendor/com.mikeschweitzer.websocket index 02ad65c..7b0a7df 160000 --- a/Assets/Talo Game Services/Talo/Runtime/Vendor/com.mikeschweitzer.websocket +++ b/Assets/Talo Game Services/Talo/Runtime/Vendor/com.mikeschweitzer.websocket @@ -1 +1 @@ -Subproject commit 02ad65ccf3ef8322b008789ad2e434dbaf376be5 +Subproject commit 7b0a7df7b58886812bf201ef71e729e5b9c76567 diff --git a/Assets/Talo Game Services/Talo/Samples/ChatDemo/Scenes/ChatDemo.unity b/Assets/Talo Game Services/Talo/Samples/ChatDemo/Scenes/ChatDemo.unity index 8280086..104d2b7 100644 --- a/Assets/Talo Game Services/Talo/Samples/ChatDemo/Scenes/ChatDemo.unity +++ b/Assets/Talo Game Services/Talo/Samples/ChatDemo/Scenes/ChatDemo.unity @@ -151,7 +151,7 @@ MonoBehaviour: m_EditorClassIdentifier: m_PanelSettings: {fileID: 11400000, guid: c2e8d45d57e604cc78799650d215a02e, type: 2} m_ParentUI: {fileID: 0} - sourceAsset: {fileID: 9197481963319205126, guid: d64908c7074e542a99b96c8605858371, type: 3} + sourceAsset: {fileID: 9197481963319205126, guid: 924337217d43d4ce2a336af8402ec3dc, type: 3} m_SortingOrder: 0 m_WorldSpaceSizeMode: 1 m_WorldSpaceWidth: 1920 diff --git a/unity.slnx b/unity.slnx index 033166a..8e1c5af 100644 --- a/unity.slnx +++ b/unity.slnx @@ -1,7 +1,7 @@  + - - +