User:Ftwm/JTSetc: Difference between revisions

From Rabid Reaction Force
Content added Content deleted
 
(2 intermediate revisions by the same user not shown)
Line 3: Line 3:
https://gitlab.com/Markworthy/nodejs-express_baublegum0v1/-/raw/master/public/src/privtest.js
https://gitlab.com/Markworthy/nodejs-express_baublegum0v1/-/raw/master/public/src/privtest.js


====HTM====
====HTML====

<pre><nowiki>

&lt;!DOCTYPE html&gt;&lt;html&gt;&lt;head&gt;
&lt;!--
https://nodejs-express-baublegum0v1a.onrender.com/baubles_
https://www.textcompare.org/
--&gt;

&lt;title&gt;Pusher Test&lt;/title&gt;
&lt;style&gt; code { color: blue; } &lt;/style&gt;
&lt;script src="https://js.pusher.com/8.2.0/pusher.min.js"&gt;&lt;/script&gt;
&lt;script src="https://gl.githack.com/Markworthy/nodejs-express_baublegum0v1/-/raw/master/public/src/privtest.js"&gt;&lt;/script&gt;

&lt;!--
&lt;script src="./privtest.js"&gt;&lt;/script&gt;
&lt;script src="./privtest.js" type="module"&gt;&lt;/script&gt;
&lt;script src="https://raw.githack.com/Markworthy-37260/Next-JS_Pusher-com_Channels-server/main/public/JSBI_etc.js" type="module"&gt;&lt;/script&gt;
--&gt;
&lt;/head&gt;&lt;body&gt;
&lt;h1&gt;Pusher.com 'Channels' product test&lt;/h1&gt;
<code>
&lt;p&gt; &lt;label for="ak_"&gt;Access Key&lt;/label&gt;
<!DOCTYPE html><html><head>
&lt;input type="text" id="ak" name="ak_"
onchange="tryNewAppKey(this.value)" &gt; &lt;/p&gt;
&lt;p&gt; &lt;label for="ck_"&gt;Option(s)&lt;/label&gt;
&lt;input type="textarea" id="ck" name="ck_"
onchange="tryNewCfgStr(this.value)" &gt; &lt;/p&gt;
&lt;!-- OUT: requires node (ATM)
&lt;p&gt; &lt;label for="sk_"&gt;Secret Key&lt;/label&gt;
&lt;input type="text" id="sk" name="sk_"&gt; &lt;/p&gt;
---&gt;
&lt;p&gt;
Test by triggering an event on channel '&lt;code&gt;main-channel&lt;/code&gt;'
with event name '&lt;code&gt;dumb-event&lt;/code&gt;' - for example by:-&lt;br /&gt;
(i) creating an account&lt;br /&gt;
(ii) downloading the pusher CLI&lt;br /&gt;
(iii) logging in with your API key:&lt;br /&gt;
"&lt;code&gt;pusher login&lt;/code&gt;"&lt;br /&gt;
(iv) triggering a dumb-event on the main-channel:&lt;br /&gt;
"&lt;code&gt;pusher channels apps trigger --app-id 1736956 --channel
main-channel --event dumb-event --message hello-world&lt;/code&gt;"&lt;br /&gt;
&lt;br /&gt;
[[waiting...]]
&lt;/p&gt;
&lt;/body&gt;&lt;/html&gt;
<title>Pusher Test</title>

<script src="https://js.pusher.com/8.2.0/pusher.min.js"></script>
</nowiki></pre>
<script src="./privtest.js"></script>
<style> code { color: blue; } </style>
</head><body>
<h1>Pusher.com 'Channels' product test</h1>
<p> <label for="ak_">Access Key</label>
<input type="text" id="ak" name="ak_"
onchange="tryNewAppKey(this.value)" > </p>
<p>
Test by triggering an event on channel '<code>main-channel</code>'
with event name '<code>dumb-event</code>' - for example by:-<br />
(i) creating an account<br />
(ii) downloading the pusher CLI<br />
(iii) logging in with your API key:<br />
"<code>pusher login</code>"<br />
(iv) triggering a dumb-event on the main-channel:<br />
"<code>pusher channels apps trigger --app-id 1736956 --channel
main-channel --event dumb-event --message hello-world</code>"<br />
<br />
[[waiting...]]
</p>
</body></html>
</code>
====JS====
var always = true; // const never= false;
;
;
var _ = { _: undefined };
_._ = _;
;
;
/**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**75**/
/**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**75**/
var pusher = null; // var channel= null; // var pusher_= null;
var eventHandler = function (stuff) {
stuff;
var counter = 0;
var ret = function (data) {
var s = JSON.stringify(data);
document.body.innerText +=
"; msg#" + ++counter + ":" + s;
};
return ret;
};
function tryNewAppKey(val) {
if (val.length == 20) { }
else
return;
pusher = new Pusher(val, {
cluster: 'eu', channelAuthorization: {
// transport: "jsonp",
endpoint: "http://localhost:8080/pusher/auth"
}
});
Pusher.logToConsole = true; // Enable pusher logging - don't include this in production
var channel = pusher.subscribe('nonprivate-channel');
channel.bind("pusher:subscription_error", function () { console.log("NOPE!"); });
channel.bind("pusher:subscription_succeeded", function () { channel.bind('unremarkable-event', eventHandler()); });
}
/**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**75**/
/**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**75**/

Latest revision as of 15:59, 27 June 2024

Pusher.com Channels client[edit]

 https://gitlab.com/Markworthy/nodejs-express_baublegum0v1/-/raw/master/public/src/privtest.js

HTML[edit]


<!DOCTYPE html><html><head>
<!--
  https://nodejs-express-baublegum0v1a.onrender.com/baubles_
  https://www.textcompare.org/
-->

  <title>Pusher Test</title>
  <style> code { color: blue; } </style>
  <script src="https://js.pusher.com/8.2.0/pusher.min.js"></script>
  <script src="https://gl.githack.com/Markworthy/nodejs-express_baublegum0v1/-/raw/master/public/src/privtest.js"></script>

<!--
  <script src="./privtest.js"></script>
  <script src="./privtest.js" type="module"></script>
  <script src="https://raw.githack.com/Markworthy-37260/Next-JS_Pusher-com_Channels-server/main/public/JSBI_etc.js" type="module"></script>
-->
</head><body>
  
  <h1>Pusher.com 'Channels' product test</h1>
  
  <p> <label for="ak_">Access Key</label>
      <input type="text" id="ak" name="ak_"
             onchange="tryNewAppKey(this.value)" > </p>
  <p> <label for="ck_">Option(s)</label>
      <input type="textarea" id="ck" name="ck_"
             onchange="tryNewCfgStr(this.value)" > </p>
  <!-- OUT: requires node (ATM)
  <p> <label for="sk_">Secret Key</label>
      <input type="text" id="sk" name="sk_"> </p>
  --->
  <p>
Test by triggering an event on channel '<code>main-channel</code>'
with event name '<code>dumb-event</code>' - for example by:-<br />
      (i) creating an account<br />
      (ii) downloading the pusher CLI<br />
      (iii) logging in with your API key:<br />
        "<code>pusher login</code>"<br />
      (iv) triggering a dumb-event on the main-channel:<br />
        "<code>pusher channels apps trigger --app-id 1736956 --channel
main-channel --event dumb-event --message hello-world</code>"<br />
        <br />
        [[waiting...]]
  </p>
  
</body></html>