This repository has been archived by the owner on Feb 6, 2022. It is now read-only.
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
fce149c
commit 02d5da6
Showing
9 changed files
with
121 additions
and
58 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package dnode; | ||
|
||
public interface ClientHandler<T> { | ||
void onConnect(T client); | ||
} |
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 |
---|---|---|
|
@@ -4,6 +4,5 @@ | |
|
||
public interface Connection { | ||
void close(); | ||
|
||
void write(JsonElement data); | ||
} |
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
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 |
---|---|---|
|
@@ -4,6 +4,5 @@ | |
|
||
public interface Server { | ||
void listen(DNode dnode) throws IOException; | ||
|
||
void shutdown() throws IOException; | ||
} |
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
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 |
---|---|---|
@@ -1,23 +1,25 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="/dnode.js"></script> | ||
<script> | ||
<head> | ||
<style>span {font-weight: bold;}</style> | ||
<script src="/dnode.js"></script> | ||
<script> | ||
window.onload = function () { | ||
var Client = function() { | ||
this.say = function(what) { | ||
console.log("say", what); | ||
}; | ||
} | ||
DNode(Client).connect(function (remote) { | ||
remote.cat(function (says) { | ||
document.getElementById('says').innerHTML = says; | ||
}); | ||
var Client = function() { | ||
this.greet = function(greeting) { | ||
document.getElementById('greeting').innerHTML = greeting; | ||
}; | ||
} | ||
DNode(Client).connect(function(cat) { | ||
cat.howAreYou(function(catReply) { | ||
document.getElementById('catReply').innerHTML = catReply; | ||
}); | ||
}); | ||
}; | ||
</script> | ||
</head> | ||
<body> | ||
The cat says <span id="says">?</span>. | ||
</body> | ||
</script> | ||
</head> | ||
<body> | ||
<div>The cat says <span id="catReply">?</span></div> | ||
<div>The server pushed <span id="greeting">?</span></div> | ||
</body> | ||
</html> |