User:Ftwm/JTSetc

From Rabid Reaction Force

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