<?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[Server State Class How To Reference Room]]></title><description><![CDATA[<p>My server does this in <code>onInit()</code>:</p>
<pre><code>this.setState(new Game())
</code></pre>
<p>I want the <code>Game</code> class to be able to call <code>broadcast</code> on the room.<br />
If I do <code>this.state.room=this</code> in <code>onInit()</code>, then this will be a part of the state and broadcast to the clients, which I don't want.<br />
How can I pass a room reference to the room state without having it be a part of the serialized state?</p>
<p>I'm using the old serializer if it matters.</p>
<p>The reason I need to do this is because my state class handles all the game logic, and the room is basically a wrapper around the state.</p>
]]></description><link>http://discuss.colyseus.io/topic/233/server-state-class-how-to-reference-room</link><generator>RSS for Node</generator><lastBuildDate>Mon, 13 Apr 2026 18:27:50 GMT</lastBuildDate><atom:link href="http://discuss.colyseus.io/topic/233.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 09 Apr 2019 18:17:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Server State Class How To Reference Room on Invalid Date]]></title><description><![CDATA[<p>My server does this in <code>onInit()</code>:</p>
<pre><code>this.setState(new Game())
</code></pre>
<p>I want the <code>Game</code> class to be able to call <code>broadcast</code> on the room.<br />
If I do <code>this.state.room=this</code> in <code>onInit()</code>, then this will be a part of the state and broadcast to the clients, which I don't want.<br />
How can I pass a room reference to the room state without having it be a part of the serialized state?</p>
<p>I'm using the old serializer if it matters.</p>
<p>The reason I need to do this is because my state class handles all the game logic, and the room is basically a wrapper around the state.</p>
]]></description><link>http://discuss.colyseus.io/post/796</link><guid isPermaLink="true">http://discuss.colyseus.io/post/796</guid><dc:creator><![CDATA[mackycheese]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Server State Class How To Reference Room on Invalid Date]]></title><description><![CDATA[<p>First off, you shouldn't do this. It's meant to be a state, which holds data. Not a lot more than that.</p>
<p>That said, if you really want to, you can add a <code>@nonenumerable</code> or <code>@nosync</code> attribute to the room variable. to make it not serialized.</p>
]]></description><link>http://discuss.colyseus.io/post/798</link><guid isPermaLink="true">http://discuss.colyseus.io/post/798</guid><dc:creator><![CDATA[seiyria]]></dc:creator><pubDate>Invalid Date</pubDate></item></channel></rss>