Permalink
Browse files

license

  • Loading branch information...
1 parent c80ab02 commit 0df3a4b382ec5c3734aaef3bfd3689dfaf2dc0ea Karl Krukow committed Sep 16, 2011
Showing with 47 additions and 10 deletions.
  1. +13 −3 README
  2. +23 −3 example/transactional-chat.html
  3. +11 −4 test/all.html
View
16 README
@@ -1,3 +1,13 @@
+LICENSE MIT:
+Copyright (c) 2011 karl.krukow@gmail.com
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
A robust full-featured Stomple client for JavaScript
Introduction in blog post:
@@ -7,14 +17,14 @@ http://blog.higher-order.net/2010/06/01/stomple-rc1-combining-websockets-and-rel
Note the word: scope is replaced by thisObj to avoid confusion
Quick Demo:
-1) Start hornetq
+1) Start hornetq
krukow:~/Projects/private/stomple$ ./hornetq/bin/run.sh ./hornetq/examples/jms/stomp-websockets/server0
Open example in a browser that supports WebSockets (e.g., Chrome)
2) open example/transactional-chat.html
Running tests:
-1) Start hornetq
+1) Start hornetq
krukow:~/Projects/private/stomple$ ./hornetq/bin/run.sh ./hornetq/examples/jms/stomp-websockets/server0
-2) open test/all.html or which ever test you want to run...
+2) open test/all.html or which ever test you want to run...
@@ -69,7 +69,27 @@
url: "ws://localhost:61614/stomp",
destination: "jms.topic.chat",
login: "guest",
- passcode: "guest"
+ passcode: "guest",
+ socketOpen: function() {
+ console.log("socket opened");
+ },
+
+ socketMessage: function(msg) {
+ console.log("socket msg");
+ console.log(msg);
+ },
+
+ socketClose: function(e) {
+ console.log("socket close");
+ console.log(e);
+ },
+
+ socketError: function() {
+ console.log("socket error");
+ console.log(client.websocket);
+ return false;
+ }
+
});
var msgHandler = {
fn: function(msg) {
@@ -79,14 +99,14 @@
};
client.subscribe({
handler: msgHandler.fn,
- scope: msgHandler,
+ thisObj: msgHandler,
success: function() {//did subscription succeed?
console.log("sub ok..");
},
failure: function(reason) {//did subscription fail?
console.log(reason);
- }
+ }
});
document.getElementById('inputText').focus();
View
@@ -28,7 +28,8 @@
<body class="yui3-skin-sam">
<h1>Note: This requires a running Stomp server with destination jms.topic.chat (see README)</h1>
<script type="text/javascript">
-
+var resultsXML = {"result": "42"};
+
if (Stomple) {
YUI({ logInclude: { TestRunner: true } }).use("test",'console', function(Y){
@@ -40,15 +41,21 @@
Y.Test.Runner.add(new Y.Test.Case(test_client_ack));
Y.Test.Runner.add(new Y.Test.Case(test_disconnect));
+ var TestRunner = Y.Test.Runner;
+ TestRunner.subscribe(TestRunner.COMPLETE_EVENT, function(){
+ console.log("extract");
+ var resultsObject = Y.Test.Runner.getResults();
+ resultsXML = Y.Test.Runner.getResults(Y.Test.Format.XML);
+ console.log(resultsXML);
+ });
+
var yconsole = new Y.Console({
newestOnTop: false
});
yconsole.render('#log');
//run the tests
- Y.Test.Runner.run();
-
-
+ Y.Test.Runner.run();
});
} else {

0 comments on commit 0df3a4b

Please sign in to comment.