<?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[About Saving Room Data]]></title><description><![CDATA[<p>Hi all,<br />
In some cases, the room needs to be destroyed but the state information of the room needs to be recorded in the database so that the state can be restored next time.What do I need to do to implement this requirement? Do I serialize and deserialize directly?</p>
]]></description><link>http://discuss.colyseus.io/topic/343/about-saving-room-data</link><generator>RSS for Node</generator><lastBuildDate>Sat, 07 Mar 2026 08:52:15 GMT</lastBuildDate><atom:link href="http://discuss.colyseus.io/topic/343.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 02 Apr 2020 03:40:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to About Saving Room Data on Thu, 02 Apr 2020 04:33:06 GMT]]></title><description><![CDATA[<p>Hi all,<br />
In some cases, the room needs to be destroyed but the state information of the room needs to be recorded in the database so that the state can be restored next time.What do I need to do to implement this requirement? Do I serialize and deserialize directly?</p>
]]></description><link>http://discuss.colyseus.io/post/1124</link><guid isPermaLink="true">http://discuss.colyseus.io/post/1124</guid><dc:creator><![CDATA[BlueBang]]></dc:creator><pubDate>Thu, 02 Apr 2020 04:33:06 GMT</pubDate></item><item><title><![CDATA[Reply to About Saving Room Data on Invalid Date]]></title><description><![CDATA[<p>There are many nested data in this root-state. It will be very cumbersome to assemble them when they are stored and used separately. Is there any way to save only  root-state?</p>
<p><a class="plugin-mentions-user plugin-mentions-a" href="http://discuss.colyseus.io/uid/1">@endel</a> Can you give me some advice？thank you.</p>
]]></description><link>http://discuss.colyseus.io/post/1125</link><guid isPermaLink="true">http://discuss.colyseus.io/post/1125</guid><dc:creator><![CDATA[BlueBang]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to About Saving Room Data on Invalid Date]]></title><description><![CDATA[<p>Hi <a class="plugin-mentions-user plugin-mentions-a" href="http://discuss.colyseus.io/uid/610">@BlueBang</a>, you should be able to call .toJSON() on your root Schema instance. Does that help?</p>
]]></description><link>http://discuss.colyseus.io/post/1126</link><guid isPermaLink="true">http://discuss.colyseus.io/post/1126</guid><dc:creator><![CDATA[endel]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to About Saving Room Data on Invalid Date]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="http://discuss.colyseus.io/uid/1">@endel</a> Thank you for your reply.But this method is called to return an object. How can I put the object into the database?use <code>JSON.stringify</code>?</p>
<pre><code class="language-javaScript">
//serverSide
onCreate(options) {
    //check if need restore
    if(true){
     let roomstate=getRoomStateFromDB();
     this.state=JSON.Parse(roomstate);// Is it used like this?
    }

}

async onDispose() {
    let roomtState=JSON.stringify(this.state.toJSON());
    storeDataBase(roomtState);// Is it used like this?
}



</code></pre>
]]></description><link>http://discuss.colyseus.io/post/1127</link><guid isPermaLink="true">http://discuss.colyseus.io/post/1127</guid><dc:creator><![CDATA[BlueBang]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to About Saving Room Data on Invalid Date]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="http://discuss.colyseus.io/uid/610">@bluebang</a> seems to. I have the same question, so I think now we must do something like that, but it could be complicated, if the game state will be too large</p>
]]></description><link>http://discuss.colyseus.io/post/1302</link><guid isPermaLink="true">http://discuss.colyseus.io/post/1302</guid><dc:creator><![CDATA[IlyaVorozhbit]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to About Saving Room Data on Invalid Date]]></title><description><![CDATA[<p>Maybe use <a href="https://docs.colyseus.io/migrating/0.14/#use-assign-instead-of-constructor" rel="nofollow">assign</a> to set the data onCreate?</p>
]]></description><link>http://discuss.colyseus.io/post/1497</link><guid isPermaLink="true">http://discuss.colyseus.io/post/1497</guid><dc:creator><![CDATA[netd777]]></dc:creator><pubDate>Invalid Date</pubDate></item></channel></rss>