Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Quick question: Can clients retrieve variables stored in the now magic pocket?

Received: by 10.58.145.167 with SMTP id sv7mr2379696veb.11.1348438184312;
        Sun, 23 Sep 2012 15:09:44 -0700 (PDT)
X-BeenThere: nowjs@googlegroups.com
Received: by 10.52.92.107 with SMTP id cl11ls3774861vdb.4.gmail; Sun, 23 Sep
 2012 15:09:43 -0700 (PDT)
Received: by 10.52.35.84 with SMTP id f20mr1607597vdj.3.1348438183346;
        Sun, 23 Sep 2012 15:09:43 -0700 (PDT)
Date: Sun, 23 Sep 2012 15:09:43 -0700 (PDT)
From: Orthonormal <s.coven...@gmail.com>
To: nowjs@googlegroups.com
Message-Id: <ccc3b37c-a72b-41f7-b623-e54d23f14c37@googlegroups.com>
In-Reply-To: <CALWN_tpHks3+m-dL6NDhybDsVGvfSTQudpeNH2k8LWHssOtvZQ@mail.gmail.com>
References: <17fcc088-480b-4ce2-ab61-20d5ffb330dd@googlegroups.com>
 <CALWN_tpHks3+m-dL6NDhybDsVGvfSTQudpeNH2k8LWHssOtvZQ@mail.gmail.com>
Subject: Re: [NowJS] Quick question: Can clients retrieve variables stored
 in the now magic pocket?
MIME-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_464_24144787.1348438183109"

------=_Part_464_24144787.1348438183109
Content-Type: multipart/alternative; 
	boundary="----=_Part_465_27692798.1348438183109"

------=_Part_465_27692798.1348438183109
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

Sorry about the very late reply. But yes, this was VERY useful information! 
Thanks!


On Friday, June 15, 2012 8:12:04 PM UTC+1, Ian Serlin wrote:
>
> Hi Orthonormal,
>
> Values you place into the magic pocket get automatically synced across 
> clients and the server and are available to all of them. If you run your 
> example and then open the console in Chrome, for instance, you would be 
> able to type "now.foo" and see that it has the value "bar".
>
> You can place variables in only one client's this.now pocket if you want, 
> but really if you want to have values that are only known to the server you 
> should keep them in a different server variable outside of the now magic 
> pockets.
>
> Hope that helps!
>
> Ian Serlin
>
> i...@ianserlin.com <javascript:>
> http://useful.io
> http://www.linkedin.com/in/ianserlin
> 213-399-1688
> @spiceninja
>
> Owner Useful IO LLC
>
>
>
> On Fri, Jun 15, 2012 at 7:17 AM, Orthonormal <s.cov...@gmail.com<javascript:>
> > wrote:
>
>>  // Server side
>>  everyone.now.setValue = function() {
>>       this.now.foo = 'bar';
>>  }
>>
>>  // Client side
>>  <script>
>>  now.ready(function(){
>>    now.setValue();
>>  });
>>
>>
>> Is the client able to get the value of foo without me allowing him to?
>>
>> Example: If this was a poker game, I might sync an array containing 
>> everyone's cards in the magic pocket. Would a player be able to cheat and 
>> retrieve the values in the array in order to know what cards everyone is 
>> holding?
>>
>
>
------=_Part_465_27692798.1348438183109
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit

Sorry about the very late reply. But yes, this was VERY useful information! Thanks!<div><br><br>On Friday, June 15, 2012 8:12:04 PM UTC+1, Ian Serlin wrote:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div>Hi Orthonormal,</div><div><br></div><div>Values you place into the magic pocket get automatically synced across clients and the server and are available to all of them. If you run your example and then open the console in Chrome, for instance, you would be able to type "now.foo" and see that it has the value "bar".</div>

<div><br></div><div>You can place variables in only one client's this.now pocket if you want, but really if you want to have values that are only known to the server you should keep them in a different server variable outside of the now magic pockets.</div>

<div><br></div><div>Hope that helps!</div><br clear="all">Ian Serlin<div><br><a href="javascript:" target="_blank" gdf-obfuscated-mailto="0-6VMocvIWkJ">i...@ianserlin.com</a><br><a href="http://useful.io" target="_blank">http://useful.io</a><br>
<a href="http://www.linkedin.com/in/ianserlin" target="_blank">http://www.linkedin.com/in/<wbr>ianserlin</a><br>
213-399-1688<br>@spiceninja<br><br></div><div>Owner Useful IO LLC</div><br>
<br><br><div class="gmail_quote">On Fri, Jun 15, 2012 at 7:17 AM, Orthonormal <span dir="ltr">&lt;<a href="javascript:" target="_blank" gdf-obfuscated-mailto="0-6VMocvIWkJ">s.cov...@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div><pre><code style="font-style:inherit;text-shadow:none;font-family:Consolas,Monaco;border-style:none!important"> <span style="color:rgb(128,128,128)">// Server side</span>
 everyone.now.setValue = <span style="font-weight:bold">function</span>() {
      <span style="font-weight:bold">this</span>.now.foo = <span style="color:green">'bar'</span>;
 }</code></pre></div><div><pre><code style="font-style:inherit;text-shadow:none;font-family:Consolas,Monaco;border-style:none!important"> <span style="color:rgb(128,128,128)">// Client side</span>
 &lt;script&gt;
 now.ready(<span style="font-weight:bold">function</span>(){
   now.setValue();
 });</code></pre></div><div><br></div><div>Is the client able to get the value of foo without me allowing him to?</div><div><br></div><div>Example: If this was a poker game, I might sync an array containing everyone's cards in the magic pocket. Would a player be able to cheat and retrieve the values in the array in order to know what cards everyone is holding?</div>

</blockquote></div><br>
</blockquote></div>
------=_Part_465_27692798.1348438183109--

------=_Part_464_24144787.1348438183109--