Skip to content

Commit ccf4c74

Browse files
committed
compatible with proxying to processId. colyseus/colyseus#176
1 parent ffd1519 commit ccf4c74

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Assets/Plugins/Colyseus/Client.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,14 @@ private void ParseMessage (byte[] bytes)
202202
endpoint.Path = "/" + room.Id;
203203
endpoint.Query = "colyseusid=" + this.Id;
204204

205-
room.SetConnection(CreateConnection(room.Id, room.Options));
205+
var processPath = "";
206+
var nextIndex = 3 + room.Id.Length;
207+
if (bytes.Length > nextIndex)
208+
{
209+
processPath = System.Text.Encoding.UTF8.GetString(bytes, nextIndex + 1, bytes[nextIndex]) + "/";
210+
}
211+
212+
room.SetConnection(CreateConnection(processPath + room.Id, room.Options));
206213
room.OnLeave += OnLeaveRoom;
207214

208215
if (rooms.ContainsKey(room.Id))

0 commit comments

Comments
 (0)