<?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[private state]]></title><description><![CDATA[<p>Hi There<br />
I want to make a poker game, and players will have their private cards, and don't  want share with other clients.  can we store cards in state and only send to specific user ?</p>
]]></description><link>http://discuss.colyseus.io/topic/157/private-state</link><generator>RSS for Node</generator><lastBuildDate>Wed, 19 Aug 2026 23:37:16 GMT</lastBuildDate><atom:link href="http://discuss.colyseus.io/topic/157.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 12 Oct 2018 06:53:59 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to private state on Fri, 12 Oct 2018 06:54:30 GMT]]></title><description><![CDATA[<p>Hi There<br />
I want to make a poker game, and players will have their private cards, and don't  want share with other clients.  can we store cards in state and only send to specific user ?</p>
]]></description><link>http://discuss.colyseus.io/post/528</link><guid isPermaLink="true">http://discuss.colyseus.io/post/528</guid><dc:creator><![CDATA[gabrieltong]]></dc:creator><pubDate>Fri, 12 Oct 2018 06:54:30 GMT</pubDate></item><item><title><![CDATA[Reply to private state on Invalid Date]]></title><description><![CDATA[<p>Maybe I can use @nosync to cards,  and make a private msg to cards owner ?</p>
]]></description><link>http://discuss.colyseus.io/post/529</link><guid isPermaLink="true">http://discuss.colyseus.io/post/529</guid><dc:creator><![CDATA[gabrieltong]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to private state on Invalid Date]]></title><description><![CDATA[<p>Make the clients listen to their own cards something like:<br />
room.listen(&quot;cards/player1/:cards&quot;);<br />
room.listen(&quot;cards/player2/:cards&quot;);<br />
etc.</p>
]]></description><link>http://discuss.colyseus.io/post/531</link><guid isPermaLink="true">http://discuss.colyseus.io/post/531</guid><dc:creator><![CDATA[jalu]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to private state on Invalid Date]]></title><description><![CDATA[<p>Hey <a class="plugin-mentions-user plugin-mentions-a" href="http://discuss.colyseus.io/uid/207">@gabrieltong</a>, welcome!</p>
<p>I'd suggest sending the private data you're not synching directly to the only client that should've access to it. I'm using exactly like this on a game I'm currently working on:</p>
<p><strong>Server-side:</strong></p>
<pre><code>this.send(client, ['cards', privateCards]);
</code></pre>
<p><strong>Client-side:</strong></p>
<pre><code>room.onMessage.add(function(message) {
  let [type, data] = message;

  if (type === &quot;cards&quot;) {
    console.log(&quot;your cards are:&quot;, data);
  }
});
</code></pre>
<p><a class="plugin-mentions-user plugin-mentions-a" href="http://discuss.colyseus.io/uid/176">@jalu</a>'s suggestion is handy, but if the user spends some time in the developer console he might retrieve the hands of the other players in order to cheat in the game.</p>
]]></description><link>http://discuss.colyseus.io/post/532</link><guid isPermaLink="true">http://discuss.colyseus.io/post/532</guid><dc:creator><![CDATA[endel]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to private state on Invalid Date]]></title><description><![CDATA[<p>Thank you man <a class="plugin-mentions-user plugin-mentions-a" href="http://discuss.colyseus.io/uid/1">@endel</a> <a class="plugin-mentions-user plugin-mentions-a" href="http://discuss.colyseus.io/uid/176">@jalu</a><br />
I think It's perfect to use<br />
<code>nosync</code> and <code>room.send</code> together.</p>
]]></description><link>http://discuss.colyseus.io/post/535</link><guid isPermaLink="true">http://discuss.colyseus.io/post/535</guid><dc:creator><![CDATA[gabrieltong]]></dc:creator><pubDate>Invalid Date</pubDate></item></channel></rss>