<?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[listen event disconnect on client and server]]></title><description><![CDATA[<p>Hello,<br />
How to to listen event disconnect on client and server?</p>
]]></description><link>http://discuss.colyseus.io/topic/188/listen-event-disconnect-on-client-and-server</link><generator>RSS for Node</generator><lastBuildDate>Mon, 20 Apr 2026 19:40:56 GMT</lastBuildDate><atom:link href="http://discuss.colyseus.io/topic/188.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 26 Dec 2018 03:17:06 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to listen event disconnect on client and server on Invalid Date]]></title><description><![CDATA[<p>Hello,<br />
How to to listen event disconnect on client and server?</p>
]]></description><link>http://discuss.colyseus.io/post/612</link><guid isPermaLink="true">http://discuss.colyseus.io/post/612</guid><dc:creator><![CDATA[jack1604]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to listen event disconnect on client and server on Invalid Date]]></title><description><![CDATA[<p>Hi <a class="plugin-mentions-user plugin-mentions-a" href="http://discuss.colyseus.io/uid/269">@jack1604</a>,</p>
<p>From client-side: <a href="http://colyseus.io/docs/client-room/#onleave" rel="nofollow">http://colyseus.io/docs/client-room/#onleave</a><br />
From server-side: <a href="http://colyseus.io/docs/api-room/#onleave-client-consented" rel="nofollow">http://colyseus.io/docs/api-room/#onleave-client-consented</a></p>
<p>Cheers!</p>
]]></description><link>http://discuss.colyseus.io/post/613</link><guid isPermaLink="true">http://discuss.colyseus.io/post/613</guid><dc:creator><![CDATA[endel]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to listen event disconnect on client and server on Invalid Date]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="http://discuss.colyseus.io/uid/1">@endel</a> said in <a href="/post/613">listen event disconnect on client and server</a>:</p>
<blockquote>
<p>Hi <a class="plugin-mentions-user plugin-mentions-a" href="http://discuss.colyseus.io/uid/269">@jack1604</a>,</p>
<p>From client-side: <a href="http://colyseus.io/docs/client-room/#onleave" rel="nofollow">http://colyseus.io/docs/client-room/#onleave</a><br />
From server-side: <a href="http://colyseus.io/docs/api-room/#onleave-client-consented" rel="nofollow">http://colyseus.io/docs/api-room/#onleave-client-consented</a></p>
<p>Cheers!</p>
</blockquote>
<p>thanks,<br />
when client rejoin success full, server will send a message, but if server send broadcast client will receive, if server send by method send, client will not receive<br />
what the problem?</p>
<p>this is my code:</p>
<p>async onLeave (client, consented) {<br />
		var room = this;<br />
		console.log(new Date(),&quot; onLeave client.sessionId:&quot;, client.sessionId, ' consented:', consented);<br />
this.broadcast(<code>${ client.sessionId } left.</code>);<br />
		if(!consented){<br />
			client.active = false;<br />
		  try {<br />
			await this.allowReconnection(client, 20);<br />
			client.active = true;			<br />
			this.broadcast(client.sessionId + ' rejoined');// client will receive<br />
			this.send(client, client.sessionId + ' rejoined'); // client not receive<br />
		  } catch (e) {<br />
			console.log(e);<br />
		  }<br />
		}<br />
}</p>
]]></description><link>http://discuss.colyseus.io/post/614</link><guid isPermaLink="true">http://discuss.colyseus.io/post/614</guid><dc:creator><![CDATA[jack1604]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to listen event disconnect on client and server on Thu, 27 Dec 2018 11:40:03 GMT]]></title><description><![CDATA[<p>Hi <a class="plugin-mentions-user plugin-mentions-a" href="http://discuss.colyseus.io/uid/269">@jack1604</a>, that's a good question, the <code>client</code> reference you're using on <code>this.send()</code> is the one that has been disconnected. The new - reconnected - client will be returned from the <code>allowReconnection()</code> method.</p>
<p><strong>Example:</strong></p>
<pre><code>try {
    const reconnectedClient = await this.allowReconnection(client, 20);
    this.send(reconnectedClient, reconnectedClient.sessionId + ' rejoined');
} catch (e) {
    console.log(e);
}
</code></pre>
<p>Hope this helps! Cheers!</p>
]]></description><link>http://discuss.colyseus.io/post/616</link><guid isPermaLink="true">http://discuss.colyseus.io/post/616</guid><dc:creator><![CDATA[endel]]></dc:creator><pubDate>Thu, 27 Dec 2018 11:40:03 GMT</pubDate></item><item><title><![CDATA[Reply to listen event disconnect on client and server on Sat, 29 Dec 2018 01:06:01 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="http://discuss.colyseus.io/uid/1">@endel</a> said in <a href="/post/616">listen event disconnect on client and server</a>:</p>
<blockquote>
<p>Hi <a class="plugin-mentions-user plugin-mentions-a" href="http://discuss.colyseus.io/uid/269">@jack1604</a>, that's a good question, the <code>client</code> reference you're using on <code>this.send()</code> is the one that has been disconnected. The new - reconnected - client will be returned from the <code>allowReconnection()</code> method.</p>
<p><strong>Example:</strong></p>
<pre><code>try {
    const reconnectedClient = await this.allowReconnection(client, 20);
    this.send(reconnectedClient, reconnectedClient.sessionId + ' rejoined');
} catch (e) {
    console.log(e);
}
</code></pre>
<p>Hope this helps! Cheers!</p>
</blockquote>
<p>hello,<br />
if client disconnect or leave room , it will receive event on room.leave(), how to detect it is disconnect or leave room? because if client is disconnected, client will rejoin. if client leave room, client will not rejoin.</p>
]]></description><link>http://discuss.colyseus.io/post/618</link><guid isPermaLink="true">http://discuss.colyseus.io/post/618</guid><dc:creator><![CDATA[jack1604]]></dc:creator><pubDate>Sat, 29 Dec 2018 01:06:01 GMT</pubDate></item></channel></rss>