mirror of
https://github.com/cheveguerra/whatsapp-api-tutorial.git
synced 2026-04-17 19:36:59 +00:00
Integrating with Express.js & Socket.io
This commit is contained in:
40
index.html
Normal file
40
index.html
Normal file
@@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Whatsapp API by Ngekoding</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="app">
|
||||
<h1>Whatsapp API</h1>
|
||||
<p>Powered by Ngekoding</p>
|
||||
<img src="" alt="QR Code" id="qrcode">
|
||||
<h3>Logs:</h3>
|
||||
<ul class="logs"></ul>
|
||||
</div>
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js" integrity="sha512-bLT0Qm9VnAYZDflyKcBaQ2gg0hSYNQrJ8RilYldYQ1FxQYoCLtUjuuRuZo+fjqhx/qtq/1itJ0C2ejDxltZVFg==" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.3.1/socket.io.min.js" integrity="sha512-/WwtKR6NnHomLo0O4w9QKc1INTPEJs7ko6u2aBTA1paPldhPl8LtXsi7a35iEZ69+9P5dcgVNESG8hrP4Y2t3w==" crossorigin="anonymous"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
var socket = io.connect('http://localhost:8000', { path: '/socket.io' });
|
||||
|
||||
socket.on('message', function(msg) {
|
||||
$('.logs').append($('<li>').text(msg));
|
||||
});
|
||||
|
||||
socket.on('qr', function(src) {
|
||||
$('#qrcode').attr('src', src);
|
||||
});
|
||||
|
||||
socket.on('ready', function(data) {
|
||||
$('#qrcode').hide();
|
||||
});
|
||||
|
||||
socket.on('authenticated', function(data) {
|
||||
$('#qrcode').hide();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user