User:Ftwm/JTSetc: Difference between revisions
Content added Content deleted
(Format HTML with (1st) <pre> and (2nd) <nowiki> tags) |
|||
Line 4: | Line 4: | ||
====HTM==== |
====HTM==== |
||
<pre><nowiki> |
|||
<!DOCTYPE html><html><head> |
|||
<!-- |
|||
https://nodejs-express-baublegum0v1a.onrender.com/baubles_ |
|||
https://www.textcompare.org/ |
|||
--> |
|||
<title>Pusher Test</title> |
|||
<script src="https://js.pusher.com/8.2.0/pusher.min.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> |
|||
--> |
|||
<style> code { color: blue; } </style> |
|||
</head><body> |
|||
<h1>Pusher.com 'Channels' product test</h1> |
|||
<code> |
|||
<p> <label for="ak_">Access Key</label> |
|||
<!DOCTYPE html><html><head> |
|||
<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> |
|||
<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**/ |
Revision as of 14:49, 27 June 2024
Pusher.com Channels client
https://gitlab.com/Markworthy/nodejs-express_baublegum0v1/-/raw/master/public/src/privtest.js
HTM
<!DOCTYPE html><html><head> <!-- https://nodejs-express-baublegum0v1a.onrender.com/baubles_ https://www.textcompare.org/ --> <title>Pusher Test</title> <script src="https://js.pusher.com/8.2.0/pusher.min.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> --> <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> <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>