Set max packet size to 10mb, and also send client info on connect
This commit is contained in:
@@ -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();
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user