| <!DOCTYPE html> |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| <html lang="en"> |
| <head> |
| <meta charset="utf-8"> |
| <title>Chat Example Using STOMP Over WebSockets</title> |
| <!--[if lt IE 9]> |
| <script src="https://html5shim.googlecode.com/svn/trunk/html5.js"></script> |
| <![endif]--> |
| <script src='https://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js'></script> |
| <script src="stomp.js"></script> |
| <script>//<![CDATA[ |
| $(document).ready(function() { |
| if(window.WebSocket) { |
| var url = "ws://localhost:61623"; |
| if(window.location.hash) { |
| url = window.location.hash.substring(1); |
| } |
| var login = "admin"; |
| var passcode = "password"; |
| destination = "/queue/websocket"; |
| |
| $("#status").html("Connecting " + url); |
| client = Stomp.client(url); |
| |
| // this allows to display debug logs directly on the web page |
| client.debug = function(str) { |
| $("#debug").append(str + "\n"); |
| }; |
| |
| // the client is notified when it is connected to the server. |
| client.connect(login, passcode, function(frame) { |
| $("#status").html("Connected"); |
| client.subscribe(destination, function(message) { |
| $("#received").html(message.body); |
| if (message.body == "messages #1000") { |
| client.disconnect(function() { |
| $("#status").html("Disconnected"); |
| }); |
| } |
| }); |
| }); |
| } else { |
| $("#status").html("No WebSockets"); |
| } |
| }); |
| //]]></script> |
| </head> |
| <body> |
| <div id="status">Loading</div> |
| <pre id="debug"></pre> |
| <div id="received"></div> |
| </body> |
| </html> |