User:Ftwm/JTSetc: Difference between revisions

From Rabid Reaction Force
Content added Content deleted
(Created page with "==Pusher.com Channels client== ====HTM==== <code> <!DOCTYPE html><html><head> <title>Pusher Test</title> <script src="https://js.pusher.com/8.2.0/pusher.min.js"></script> <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>...")
 
Line 1: Line 1:
==Pusher.com Channels client==
==Pusher.com Channels client==

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


====HTM====
====HTM====

<code>

<!DOCTYPE html><html><head>

<title>Pusher Test</title>
<script src="https://js.pusher.com/8.2.0/pusher.min.js"></script>
<script src="./privtest.js"></script>

<style> code { color: blue; } </style>

</head><body>
<code>
<h1>Pusher.com 'Channels' product test</h1>
<!DOCTYPE html><html><head>
<title>Pusher Test</title>
<script src="https://js.pusher.com/8.2.0/pusher.min.js"></script>
<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>
<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====
====JS====

var always = true; // const never= false;
var always = true; // const never= false;
;
;
;
;
var _ = { _: undefined };
var _ = { _: undefined };
_._ = _;
_._ = _;
;
;
;
;
/**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**75**/
/**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**75**/
/**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**75**/
/**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**75**/
var pusher = null; // var channel= null; // var pusher_= null;
var pusher = null; // var channel= null; // var pusher_= null;
var eventHandler = function (stuff) {
var eventHandler = function (stuff) {
stuff;
stuff;
var counter = 0;
var counter = 0;
var ret = function (data) {
var ret = function (data) {
var s = JSON.stringify(data);
var s = JSON.stringify(data);
document.body.innerText +=
document.body.innerText +=
"; msg#" + ++counter + ":" + s;
"; msg#" + ++counter + ":" + s;
};
};
return ret;
return ret;
};
};
function tryNewAppKey(val) {
function tryNewAppKey(val) {
if (val.length == 20) { }
if (val.length == 20) { }
else
else
return;
return;
pusher = new Pusher(val, {
pusher = new Pusher(val, {
cluster: 'eu', channelAuthorization: {
cluster: 'eu', channelAuthorization: {
// transport: "jsonp",
// transport: "jsonp",
endpoint: "http://localhost:8080/pusher/auth"
endpoint: "http://localhost:8080/pusher/auth"
}
}
});
});
Pusher.logToConsole = true; // Enable pusher logging - don't include this in production
Pusher.logToConsole = true; // Enable pusher logging - don't include this in production
var channel = pusher.subscribe('nonprivate-channel');
var channel = pusher.subscribe('nonprivate-channel');
channel.bind("pusher:subscription_error", function () { console.log("NOPE!"); });
channel.bind("pusher:subscription_error", function () { console.log("NOPE!"); });
channel.bind("pusher:subscription_succeeded", function () { channel.bind('unremarkable-event', eventHandler()); });
channel.bind("pusher:subscription_succeeded", function () { channel.bind('unremarkable-event', eventHandler()); });
}
}
/**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**75**/
/**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**75**/
/**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**75**/
/**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**\ \**/ /**75**/

Revision as of 12:16, 25 June 2024

Pusher.com Channels client

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

HTM

 
 
 <!DOCTYPE html><html><head>
 
   <title>Pusher Test</title>
   <script src="https://js.pusher.com/8.2.0/pusher.min.js"></script>
   <script src="./privtest.js"></script>
 
   <style> code { color: blue; } </style>
 
 </head><body>
   

Pusher.com 'Channels' product test

<label for="ak_">Access Key</label> <input type="text" id="ak" name="ak_" onchange="tryNewAppKey(this.value)" >

Test by triggering an event on channel 'main-channel' with event name 'dumb-event' - for example by:-
(i) creating an account
(ii) downloading the pusher CLI
(iii) logging in with your API key:
"pusher login"
(iv) triggering a dumb-event on the main-channel:
"pusher channels apps trigger --app-id 1736956 --channel main-channel --event dumb-event --message hello-world"

waiting...

 </body></html>
 
 
 

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**/