added pengguna,kurir page, with socket.io,need to switch this to node.js first
This commit is contained in:
27
public/index.html
Normal file
27
public/index.html
Normal file
@ -0,0 +1,27 @@
|
||||
<!-- public/index.html -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Receiver Page</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>This is index.html (Receiver)</h2>
|
||||
|
||||
<script src="https://cdn.socket.io/4.7.5/socket.io.min.js"></script>
|
||||
<script>
|
||||
const socket = io();
|
||||
|
||||
socket.on('connect', () => {
|
||||
console.log('Connected to server:', socket.id);
|
||||
});
|
||||
|
||||
socket.on('scan_dia_lagi', (data) => {
|
||||
console.log('📨 Received scan_dia_lagi:', data);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
26
public/index2.html
Normal file
26
public/index2.html
Normal file
@ -0,0 +1,26 @@
|
||||
<!-- public/index2.html -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Emitter Page</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>This is index2.html (Emitter)</h2>
|
||||
<button onclick="emitScan()">Emit scan_dia_lagi</button>
|
||||
|
||||
<script src="https://cdn.socket.io/4.7.5/socket.io.min.js"></script>
|
||||
<script>
|
||||
const socket = io();
|
||||
|
||||
socket.on('connect', () => {
|
||||
console.log('Connected to server:', socket.id);
|
||||
});
|
||||
|
||||
function emitScan() {
|
||||
socket.emit('scan_dia_lagi', 'Hello from index2.html!');
|
||||
console.log('📤 Emitted scan_dia_lagi');
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user