-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dispatch onJoin signal if client already has 'colyseusid' cookie. col…
- Loading branch information
Showing
8 changed files
with
88 additions
and
15 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
dist/lib | ||
out.log | ||
node_modules | ||
npm-debug.log |
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,2 @@ | ||
/dist | ||
src |
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<style> | ||
body { font-family: Tahoma, Geneva, sans-serif; } | ||
</style> | ||
<script src="colyseus.js"></script> | ||
</head> | ||
<body> | ||
<strong>Messages</strong><br> | ||
|
||
<form id="form"> | ||
<input type="text" id="input" value="" /> | ||
<input type="submit" value="send" /> | ||
</form> | ||
|
||
<div id="messages"></div> | ||
|
||
<script> | ||
var host = window.document.location.host.replace(/:.*/, ''); | ||
var client = new Colyseus.Client('ws://' + host + ':8080'); | ||
var room; | ||
|
||
// client.onopen = function() { | ||
// console.log('onopen!'); | ||
// client.send("hey"); | ||
// } | ||
// | ||
// client.onmessage = function(data) { | ||
// console.log("onmessage", data) | ||
// } | ||
|
||
client.onOpen.add(function() { | ||
console.log("onOpen") | ||
|
||
room = client.join('chat'); | ||
room.onJoin.add(function() { | ||
console.log('joined!'); | ||
}) | ||
|
||
room.onUpdate.add(function(data) { | ||
console.log("chat update: ", data) | ||
}); | ||
}); | ||
|
||
document.getElementById('form').onsubmit = function(e) { | ||
e.preventDefault() | ||
|
||
client.send(document.getElementById('input').value); | ||
|
||
// room.send(document.getElementById('input').value); | ||
document.getElementById('input').value = null | ||
} | ||
</script> | ||
|
||
</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
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