forked from goodow/realtime-web-playground
-
Notifications
You must be signed in to change notification settings - Fork 0
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
larry
committed
Jul 11, 2014
1 parent
f0c7112
commit 4545ee4
Showing
9 changed files
with
487 additions
and
3 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,3 @@ | ||
{ | ||
"directory": "app/bower_components" | ||
} |
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,59 @@ | ||
*.pyc | ||
.project | ||
.pydevproject | ||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm | ||
|
||
## Directory-based project format | ||
.idea/ | ||
# if you remove the above rule, at least ignore user-specific stuff: | ||
# .idea/workspace.xml | ||
# .idea/tasks.xml | ||
# and these sensitive or high-churn files: | ||
# .idea/dataSources.ids | ||
# .idea/dataSources.xml | ||
# .idea/sqlDataSources.xml | ||
# .idea/dynamic.xml | ||
|
||
## File-based project format | ||
*.ipr | ||
*.iws | ||
*.iml | ||
|
||
## Additional for IntelliJ | ||
out/ | ||
|
||
# generated by mpeltonen/sbt-idea plugin | ||
.idea_modules/ | ||
|
||
# generated by JIRA plugin | ||
atlassian-ide-plugin.xml | ||
|
||
# generated by Crashlytics plugin (for Android Studio and Intellij) | ||
com_crashlytics_export_strings.xml | ||
|
||
## OS X | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
|
||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear on external disk | ||
.Spotlight-V100 | ||
.Trashes | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
bower_components/ | ||
|
||
# Logs | ||
logs | ||
*.log | ||
node_modules |
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,30 @@ | ||
language: node_js | ||
node_js: | ||
- 0.10 | ||
|
||
branches: | ||
only: | ||
- master | ||
|
||
before_install: | ||
- git config --global user.name "Goodow Dev" | ||
- git config --global user.email "[email protected]" | ||
- git remote set-url origin "https://${GH_TOKEN}@github.com/goodow/realtime-web-playground.git" | ||
- git fetch origin gh-pages:gh-pages | ||
|
||
before_script: | ||
- export DISPLAY=:99.0 | ||
- sh -e /etc/init.d/xvfb start | ||
- npm start > /dev/null & | ||
- npm run update-webdriver | ||
- sleep 1 | ||
|
||
after_success: | ||
- cp -r app/ .gh-pages/ | ||
- git checkout gh-pages && cp -r .gh-pages/* . && rm -rf .gh-pages/ app/ node_modules/ | ||
- git add . && git commit -m "Generated by ${TRAVIS_COMMIT}" | ||
- test ${TRAVIS_PULL_REQUEST} == "false" && git push origin | ||
|
||
env: | ||
global: | ||
secure: gECuwl39mTQ1XRBBYAkrD42YUj1p0fdDlDIbjRBQaxLdUVNvPHZiV0/jTJgnvG+lEwJNIAaDGuw+rIK+/+VlbVE6LWQgRuwAB5eBI18NFNNytXUvvnS2IREYKRGPuRwC4a51V3Q0L+zTyg8xVzNQSNl7N2J/znVBUlXMCzAy95E= |
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,166 @@ | ||
<html> | ||
<head> | ||
<title>Goodow Realtime Channel API Playground</title> | ||
<script src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.0.min.js"></script> | ||
<script src="bower_components/bower-sockjs-client/sockjs.js"></script> | ||
<!--<script src="bower_components/realtime-channel/channel.nocache.js"></script>--> | ||
<script src="bower_components/realtime-channel/realtime-channel.js"></script> | ||
</head> | ||
<style> | ||
.box { | ||
background-color: #F0F0F0; | ||
border: 4px solid green; | ||
width: 400px; | ||
height: 300px; | ||
} | ||
|
||
.innerbox { | ||
overflow: auto; | ||
border: 3px solid green; | ||
border-left: 0px; | ||
border-right: 0px; | ||
} | ||
|
||
body { | ||
background-color: #F0F0F0; | ||
} | ||
</style> | ||
|
||
<body> | ||
<div > | ||
<label>Server: </label> | ||
<input type="text" id="server" placeholder="http:https://host:port/channel" style="width: 250px" /> | ||
<input type="button" id="connectButton" value="Connect"/> | ||
</div> | ||
|
||
<div id="status" class="box" style="position:absolute;left:0px;top:40px"> | ||
<input type="button" id="closeButton" value="Close connection"/><br> | ||
Connection Status: | ||
<div id="status_info">Not connected</div> | ||
</div> | ||
|
||
<div id="subscribe" class="box" style="position:absolute;left:450px;top:40px"> | ||
|
||
<form onsubmit="return false;"> | ||
Topic:<input type="text" id="subscribeTopic" value="sometopic"/> | ||
<input type="button" id="subscribeButton" value="Subscribe"/> | ||
</form> | ||
Subscriptions: | ||
<div id="subscribed" class="innerbox" style="width: 400px; height: 255px;"> | ||
</div> | ||
</div> | ||
|
||
<div id="send" class="box" style="position:absolute;left:0px;top:350px"> | ||
|
||
<form onsubmit="return false;"> | ||
Topic:<input type="text" id="sendTopic" value="sometopic"/><br> | ||
Message:<input type="text" id="sendMessage" value="Hello, World!"/> | ||
<input type="button" id="sendButton" value="Send message"/> | ||
</form> | ||
|
||
Sent messages:<br> | ||
<div id="sent" class="innerbox" style="width: 400px; height: 215px;"> | ||
</div> | ||
</div> | ||
<br> | ||
|
||
<div id="receive" class="box" style="position:absolute;left:450px;top:350px"> | ||
|
||
Received messages:<br> | ||
|
||
<div id="received" class="innerbox" style="width: 400px; height: 280px;"> | ||
</div> | ||
</div> | ||
|
||
<script> | ||
|
||
var bus = null; | ||
|
||
function publish(topic, message) { | ||
if (bus) { | ||
var json = {text: message}; | ||
bus.publish(topic, json); | ||
/*bus.send(topic, json, function(message) { | ||
message.reply({end: "reply"}); | ||
});*/ | ||
$('#sent').append($("<code>").text("Topic:" + topic + " Message:" + JSON.stringify(json))); | ||
$('#sent').append($("</code><br>")); | ||
} | ||
} | ||
|
||
function subscribe(topic) { | ||
if (bus) { | ||
window.registration = bus.subscribe(topic, function(message) { | ||
window.message = message; | ||
$('#received').append("Topic:" + topic + " Message:" + JSON.stringify(message.body()) + "<br>"); | ||
var f = function(message) { | ||
console.log(JSON.stringify(message.body())); | ||
}; | ||
message.reply({a:"b"}, f); | ||
}); | ||
$('#subscribed').append($("<code>").text("Topic:" + topic)); | ||
$('#subscribed').append($("</code><br>")); | ||
|
||
// You can unsubscribe the topic like this: | ||
// registration.unregister(); | ||
} | ||
} | ||
|
||
function closeConn() { | ||
if (bus) { | ||
bus.close(); | ||
bus = null; | ||
} | ||
} | ||
|
||
function openConn() { | ||
var server = $('#server').val(); | ||
window.location.hash = '#server='+ server; | ||
if (!bus) { | ||
var options = {debug:true, forkLocal:true}; | ||
bus = new realtime.channel.ReconnectBus(server, options); | ||
|
||
bus.subscribeLocal("@realtime/bus/onOpen", function(message) { | ||
$("#status_info").text("Connected"); | ||
console.log("Opened at: " + new Date().toString()); | ||
}); | ||
|
||
bus.subscribeLocal("@realtime/bus/onClose", function(message) { | ||
$("#status_info").text("Not connected"); | ||
console.log("Closed at: " + new Date().toString()); | ||
}); | ||
|
||
bus.subscribeLocal("@realtime/bus/onError", function(error) { | ||
console.log("Error at: " + error); | ||
}); | ||
} | ||
} | ||
|
||
$(document).ready(function() { | ||
var server = "https://realtime.goodow.com/channel"; | ||
var hash = window.location.hash; | ||
if (hash) { | ||
server = hash.substring(hash.indexOf('=') + 1); | ||
} | ||
$('#server').val(server); | ||
$("#sendButton").click(function() { | ||
publish($("#sendTopic").val(), $("#sendMessage").val()); | ||
}); | ||
|
||
$("#subscribeButton").click(function() { | ||
subscribe($("#subscribeTopic").val()); | ||
}); | ||
|
||
$("#closeButton").click(function() { | ||
closeConn(); | ||
}); | ||
|
||
$("#connectButton").click(function() { | ||
openConn(); | ||
}); | ||
}); | ||
|
||
</script> | ||
<a href="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/goodow/realtime-web-playground"><img style="position: fixed; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_green_007200.png" alt="Fork me on GitHub"></a> | ||
</body> | ||
</html> |
Oops, something went wrong.