mirror of
https://github.com/simon987/ws_feed_adapter.git
synced 2025-12-17 09:19:06 +00:00
Initial commit
This commit is contained in:
33
exemples/demo.html
Normal file
33
exemples/demo.html
Normal file
@@ -0,0 +1,33 @@
|
||||
<!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>
|
||||
Reference in New Issue
Block a user