Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I don't think you actually have a problem here. </p> <p>You are able to send messages to users that are logged in or not. </p> <p>The problem you are having I think is knowing that there are multiple ways to use the channel API re: tokens. </p> <p><a href="https://developers.google.com/appengine/docs/python/channel/overview#Life_of_a_Typical_Channel_Message" rel="nofollow noreferrer">https://developers.google.com/appengine/docs/python/channel/overview#Life_of_a_Typical_Channel_Message</a></p> <blockquote> <p>In this example, it shows the JavaScript client explicitly requests a token and sends its Client ID to the server. In contrast, you could choose to design your application to inject the token into the client before the page loads in the browser, or some other implementation if preferred.</p> </blockquote> <p><img src="https://i.stack.imgur.com/pzluc.png" alt="Option 1"></p> <blockquote> <p>This diagram shows the creation of a channel on the server. <strong>In this example, it shows the JavaScript client explicitly requests a token and sends its Client ID to the server.</strong> In contrast, you could choose to design your application to inject the token into the client before the page loads in the browser, or some other implementation if preferred.</p> </blockquote> <p>Here's my demo implementation, hope it helps somehow: <a href="https://github.com/Paul1234321/channelapidemo.git" rel="nofollow noreferrer">https://github.com/Paul1234321/channelapidemo.git</a></p> <p>Here's the code for creating the channel on GAE:</p> <pre><code> client_id = str(uuid.uuid4()).replace("-",'') channel_token = channel.create_channel(client_id) </code></pre> <p>And in the JS:</p> <pre><code>channel = new goog.appengine.Channel('{{ token }}'); </code></pre> <p>Have a look at it in action: <a href="http://pppredictor.appspot.com/" rel="nofollow noreferrer">http://pppredictor.appspot.com/</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload