In order to reproduce the issue, just in any project when the server is running, and the client is connected, you need a tool to simulate the lag or the slow internet like (clumsy ) jagt.github.io/clumsy/index.html .
Then, when start the tool, some issues appears in the console client.
This happend without the tool, just in the real life when the user has slow internet.
Posts made by lucks
Thank you very much, it worked perfectly.
I have an error that when the socket is closed it throws the client in webgl and it freezes.
"TypeError: Cannot read property 'readyState' of undefined at _WebSockedSend "
Unity 2020.1.11 f1
colyseus : 0.14
I was thinking that maybe going through the existing in this new technology can help performance a little.
Solution:
room.OnLeave += (code) => {
Debug.Log("ROOM: ON LEAVE, code => " + code);
ReconnectRoom();
};
async void ReconnectRoom()
{
string roomId = PlayerPrefs.GetString("roomId");
string sessionId = PlayerPrefs.GetString("sessionId");
if (string.IsNullOrEmpty(sessionId) || string.IsNullOrEmpty(roomId))
{
Debug.Log("Cannot Reconnect without having a roomId and sessionId");
return;
}
room = await client.Reconnect<State>(roomId, sessionId);
Debug.Log("Reconnected into room successfully.");
RegisterRoomHandlers();
}
Solution: Changed to 0.14 , now testing.
On running the game the following error throw on the console of unity Editor
IndexOutOfRangeException: Index was outside the bounds of the array.
Colyseus.Schema.Schema.CreateTypeInstance (System.Byte[] bytes, Colyseus.Schema.Iterator it, System.Type type) (at Assets/Plugins/Colyseus/Serializer/Schema/Schema.cs:753)
Colyseus.Schema.Schema.Decode (System.Byte[] bytes, Colyseus.Schema.Iterator it) (at Assets/Plugins/Colyseus/Serializer/Schema/Schema.cs:658)
Colyseus.SchemaSerializer1[T].Patch (System.Byte[] data, System.Int32 offset) (at Assets/Plugins/Colyseus/Serializer/SchemaSerializer.cs:30) Colyseus.Room
1[T].Patch (System.Byte[] delta, System.Int32 offset) (at Assets/Plugins/Colyseus/Room.cs:326)
Colyseus.Room`1+<ParseMessage>d__37[T].MoveNext () (at Assets/Plugins/Colyseus/Room.cs:285)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <fb001e01371b4adca20013e0ac763896>:0)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) (at <fb001e01371b4adca20013e0ac763896>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at <a9810827dce3444a8e5c4e9f3f5e0828>:0)
UnityEngine.UnitySynchronizationContext:ExecuteTasks()
Hi , I have a game running on heroku, but on certain time I get some of the follow code on the server:
2020-09-24T18:02:17.725202+00:00 heroku[router]: at=info method=GET path="/sV4fSkj6g/trtp8tPvp?sessionId=vvWRdGKW1" host=myapp.herokuapp.com request_id=914eb756-b46c-4042-b290-0284c35203a6 fwd="177.237.154.246" dyno=web.1 connect=1ms service=574791ms status=101 bytes=129 protocol=https
2020-09-24T18:02:17.711452+00:00 heroku[router]: at=info method=GET path="/sV4fSkj6g/ZNxVksd6g?sessionId=7mv_XdznN" host=myapp.herokuapp.com request_id=d69e6f15-95d8-4463-915e-6f32aa6023e3 fwd="177.237.154.246" dyno=web.1 connect=0ms service=596820ms status=101 bytes=129 protocol=https
2020-09-24T18:02:17.725482+00:00 app[web.1]: player 7mv_XdznN leaved
2020-09-24T18:02:17.733409+00:00 app[web.1]: player vvWRdGKW1 leaved
then the player left the game but I need to recconnect it, I put the code of recconect on colyseus, but I don't know if any have an example to reconnect on Unity c#.
@endel said in room.OnMessage not registered for Schema message: MyMessage:
room.OnMessage((MyMessage message) =>
{
Debug.Log("Received Schema message:");
Debug.Log(message.message);
});
Works perfect, thanks, yes I was reading the documentation, but not well at all.