-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ebf5a90
commit ae90498
Showing
18 changed files
with
44 additions
and
291 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
|
||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Websocket Example</title> | ||
</head> | ||
<body> | ||
<script type="module" src="./index.js"></script> | ||
<h1>Substreams WebSocket</h1> | ||
<div>Hash Module</div> | ||
<form id="form"> | ||
<input type="text" id="message" size="45" placeholder="Hash Module" value="90a60a0dccc4ba24b84f93fb777af45cd7a70350"> | ||
<input type="button" id="send" value="Send"> | ||
</form> | ||
<div id="messages"></div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const messages = document.querySelector("#messages"); | ||
const send = document.querySelector("#send"); | ||
const message = document.querySelector("#message"); | ||
|
||
const ws = new WebSocket("ws://localhost:3000"); | ||
|
||
ws.onopen = () => { | ||
console.log("Connected!"); | ||
ws.send("90a60a0dccc4ba24b84f93fb777af45cd7a70350"); | ||
}; | ||
|
||
ws.onmessage = (event) => { | ||
console.log(`Message from server: ${event.data}`); | ||
messages.innerHTML += `<li>${event.data}</li>`; | ||
}; | ||
|
||
send.addEventListener("click", () => { | ||
ws.send(message.value) | ||
}) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters