<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[CSAMatchMakeException only thrown sometimes in JoinById]]></title><description><![CDATA[<p>I'm using the Unity client, with Unity version <code>2020.3.19f1</code>.</p>
<p>I'm throwing <code>ServerError</code> server side in <code>onAuth</code>, but it's only re-thrown sometimes on the client, as opposed to every time. Most of the time, the async task will just keep hanging there forever and neither resolve nor throw.</p>
<p>The first attempt usually throws correctly (but not quite every single time).</p>
<p>Below is the result of attempting the same action twice in a row, with the same parameters:</p>
<p><strong>Unity log:</strong></p>
<p><img src="/assets/uploads/files/1634506457852-e39e2b98-cbf1-4587-a73d-ac9ab597798e-obraz-resized.png" alt="0_1634506461219_e39e2b98-cbf1-4587-a73d-ac9ab597798e-obraz.png" class="img-responsive img-markdown" /></p>
<p><strong>Server log:</strong></p>
<p><img src="/assets/uploads/files/1634506582374-32b62a36-11c0-473b-8958-1efb0487fd5c-obraz-resized.png" alt="0_1634506586096_32b62a36-11c0-473b-8958-1efb0487fd5c-obraz.png" class="img-responsive img-markdown" /></p>
<hr />
<p><strong>Client-side code:</strong></p>
<pre><code class="language-CSharp">try {
	// Connect to lobby room
	var _room = await colyseus.JoinById&lt;LobbyState&gt;(colyseusSettings.lobbyRoomId, new Dictionary&lt;string, object&gt;{
		{ &quot;username&quot;, _credentials.username },
		{ &quot;password&quot;, _credentials.password }
	});
} catch ( CSAMatchMakeException ex ) {
	if (ex.Code == 401) {
		throw new WrongCredentialsException(ex.Message, _credentials.username, _credentials.password);
	} else if (ex.Code &gt;= 500) {
		throw new LoginServerException(ex.Message);
	} else {
		throw new LoginUnknownException(ex.Message);
	}
} catch ( Exception ex ) {
	throw new LoginUnknownException(ex.Message);
}
</code></pre>
<p><strong>Server-side code:</strong></p>
<pre><code class="language-JS">if (!account) {
    log.debug({ roomType: 'LobbyRoom', roomId: this.roomId, client, username: options.username }, '[LobbyRoom] Client authentication failed - no matching account for provided credentials');
    throw new ServerError(401, 'No matching account found for username and password');
}
</code></pre>
<p>The entire <code>onAuth</code> method is <code>async</code> and returns a <code>Promise&lt;T&gt;</code>.</p>
]]></description><link>http://discuss.colyseus.io/topic/526/csamatchmakeexception-only-thrown-sometimes-in-joinbyid</link><generator>RSS for Node</generator><lastBuildDate>Tue, 09 Jun 2026 18:28:03 GMT</lastBuildDate><atom:link href="http://discuss.colyseus.io/topic/526.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 17 Oct 2021 21:39:57 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to CSAMatchMakeException only thrown sometimes in JoinById on Sun, 17 Oct 2021 22:06:37 GMT]]></title><description><![CDATA[<p>I'm using the Unity client, with Unity version <code>2020.3.19f1</code>.</p>
<p>I'm throwing <code>ServerError</code> server side in <code>onAuth</code>, but it's only re-thrown sometimes on the client, as opposed to every time. Most of the time, the async task will just keep hanging there forever and neither resolve nor throw.</p>
<p>The first attempt usually throws correctly (but not quite every single time).</p>
<p>Below is the result of attempting the same action twice in a row, with the same parameters:</p>
<p><strong>Unity log:</strong></p>
<p><img src="/assets/uploads/files/1634506457852-e39e2b98-cbf1-4587-a73d-ac9ab597798e-obraz-resized.png" alt="0_1634506461219_e39e2b98-cbf1-4587-a73d-ac9ab597798e-obraz.png" class="img-responsive img-markdown" /></p>
<p><strong>Server log:</strong></p>
<p><img src="/assets/uploads/files/1634506582374-32b62a36-11c0-473b-8958-1efb0487fd5c-obraz-resized.png" alt="0_1634506586096_32b62a36-11c0-473b-8958-1efb0487fd5c-obraz.png" class="img-responsive img-markdown" /></p>
<hr />
<p><strong>Client-side code:</strong></p>
<pre><code class="language-CSharp">try {
	// Connect to lobby room
	var _room = await colyseus.JoinById&lt;LobbyState&gt;(colyseusSettings.lobbyRoomId, new Dictionary&lt;string, object&gt;{
		{ &quot;username&quot;, _credentials.username },
		{ &quot;password&quot;, _credentials.password }
	});
} catch ( CSAMatchMakeException ex ) {
	if (ex.Code == 401) {
		throw new WrongCredentialsException(ex.Message, _credentials.username, _credentials.password);
	} else if (ex.Code &gt;= 500) {
		throw new LoginServerException(ex.Message);
	} else {
		throw new LoginUnknownException(ex.Message);
	}
} catch ( Exception ex ) {
	throw new LoginUnknownException(ex.Message);
}
</code></pre>
<p><strong>Server-side code:</strong></p>
<pre><code class="language-JS">if (!account) {
    log.debug({ roomType: 'LobbyRoom', roomId: this.roomId, client, username: options.username }, '[LobbyRoom] Client authentication failed - no matching account for provided credentials');
    throw new ServerError(401, 'No matching account found for username and password');
}
</code></pre>
<p>The entire <code>onAuth</code> method is <code>async</code> and returns a <code>Promise&lt;T&gt;</code>.</p>
]]></description><link>http://discuss.colyseus.io/post/1636</link><guid isPermaLink="true">http://discuss.colyseus.io/post/1636</guid><dc:creator><![CDATA[Unelith]]></dc:creator><pubDate>Sun, 17 Oct 2021 22:06:37 GMT</pubDate></item><item><title><![CDATA[Reply to CSAMatchMakeException only thrown sometimes in JoinById on Invalid Date]]></title><description><![CDATA[<p>Did you try to update the Unity client SDK?</p>
]]></description><link>http://discuss.colyseus.io/post/1639</link><guid isPermaLink="true">http://discuss.colyseus.io/post/1639</guid><dc:creator><![CDATA[COCO]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to CSAMatchMakeException only thrown sometimes in JoinById on Invalid Date]]></title><description><![CDATA[<p>I have the newest Colyseus SDK version in <code>0.14.8</code></p>
]]></description><link>http://discuss.colyseus.io/post/1644</link><guid isPermaLink="true">http://discuss.colyseus.io/post/1644</guid><dc:creator><![CDATA[Unelith]]></dc:creator><pubDate>Invalid Date</pubDate></item></channel></rss>