mirror of
https://github.com/simon987/ws_feed_adapter.git
synced 2025-04-10 14:06:44 +00:00
33 lines
525 B
HTML
33 lines
525 B
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>ws_feed_adapter Demo</title>
|
|
</head>
|
|
<body>
|
|
|
|
<script>
|
|
let socket = new WebSocket("ws://localhost:3090/socket");
|
|
|
|
socket.onmessage = function(msg) {
|
|
|
|
let j = JSON.parse(msg.data);
|
|
console.log(j)
|
|
};
|
|
|
|
socket.onopen = function() {
|
|
socket.send(JSON.stringify({
|
|
exchange: "reddit",
|
|
topics: [
|
|
"submission.*",
|
|
]
|
|
}))
|
|
};
|
|
|
|
socket.onerror = function (err) {
|
|
console.log(err)
|
|
}
|
|
|
|
</script>
|
|
</body>
|
|
</html> |