Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title></title>
- <script src="Scripts/jquery.js"></script>
- <script src="Scripts/jXSockets.js"></script>
- <script src="Scripts/jXSockets.fallback.js"></script>
- <script>
- var ws = null;
- $(function() {
- //See http://pastebin.com/HEkdy9nL for C# code called
- ws = new XSockets.WebSocket('ws://127.0.0.1:4502/Test');
- ws.bind(XSockets.Events.close, function () {
- console.log('CLOSED');
- });
- ws.bind(XSockets.Events.open, function () {
- console.log('OPEN');
- });
- $('#hardkill').bind('click', function(e) {
- e.preventDefault();
- ws.close();
- });
- $('#softkill').bind('click', function (e) {
- e.preventDefault();
- ws.trigger('terminate', {});
- });
- });
- </script>
- </head>
- <body>
- <button id="hardkill">Close From Client</button>
- <button id="softkill">Close By Calling Server From Client</button>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement