Set max packet size to 10mb, and also send client info on connect

This commit is contained in:
2026-01-24 11:27:17 -07:00
parent d0a9c29c20
commit bf4eff2ee2
2 changed files with 8 additions and 18 deletions

View File

@@ -1,9 +1,13 @@
using System;
using UnityEngine;
[Serializable]
public class ConnectedWithCurrentSceneMessage
{
public string type = "connected_with_current_scene";
public string sceneName;
public string Requester = "BerryDashClient";
public string ClientVersion = Application.version;
public string ClientPlatform = Application.platform.ToString();
public long timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
}

View File

@@ -26,6 +26,10 @@ public class WebsocketHandler : MonoBehaviour
DontDestroyOnLoad(gameObject);
_Connection = gameObject.AddComponent<WebSocketConnection>();
_Connection.DesiredConfig = new WebSocketConfig
{
MaxReceiveBytes = 10 * 1024 * 1024
};
_Connection.StateChanged += OnStateChanged;
_Connection.ErrorMessageReceived += OnErrorMessageReceived;
@@ -73,15 +77,6 @@ public class WebsocketHandler : MonoBehaviour
sceneName = currentSceneName
};
_Connection.AddOutgoingMessage(JsonUtility.ToJson(msg));
if (currentSceneName == "ChatroomMenu")
{
RequestInfoMessage msg2 = new()
{
kind = "chatroom_messages"
};
_Connection.AddOutgoingMessage(JsonUtility.ToJson(msg2));
}
}
}
@@ -109,15 +104,6 @@ public class WebsocketHandler : MonoBehaviour
from = lastSceneName
};
_Connection.AddOutgoingMessage(JsonUtility.ToJson(msg));
if (scene.name == "ChatroomMenu")
{
RequestInfoMessage msg2 = new()
{
kind = "chatroom_messages"
};
_Connection.AddOutgoingMessage(JsonUtility.ToJson(msg2));
}
}
lastSceneName = scene.name;
}