Created
May 10, 2011 09:42
-
-
Save erubboli/964188 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta http-equiv="Content-type" content="text/html; charset=utf-8"> | |
| <title>Auctions Test</title> | |
| <script type="text/javascript" charset="utf-8" src="node_modules/faye/faye-browser.js"></script> | |
| <script type="text/javascript" charset="utf-8" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.js"></script> | |
| <script type="text/javascript" charset="utf-8"> | |
| bayeux_client = new Faye.Client('http://localhost:8000/auctions'); | |
| $(".subscribe_button").live('click',function(ev){ | |
| var id = $(this).data('auction-id'); | |
| bayeux_client.subscribe("/"+id,function(message){ | |
| alert(message.action+" auction "+id) | |
| }); | |
| }); | |
| $(".bid_button").live('click',function(ev){ | |
| var id = $(this).data('auction-id'); | |
| bayeux_client.publish("/"+id, {action: 'bid '}); | |
| }); | |
| </script> | |
| </head> | |
| <body id="faye"> | |
| <table border="0" cellspacing="5" cellpadding="5"> | |
| <tr> | |
| <td>0</td> | |
| <td>monitor</td> | |
| <td><span id="auction_0_reset" class="bid_button" data-auction-id="0">bid</span></td> | |
| <td><span id="auction_0_subscribe" class="subscribe_button" data-auction-id="0">subscribe</span></td> | |
| </tr> | |
| <tr> | |
| <td>1</td> | |
| <td>keyboard</td> | |
| <td><span id="auction_1_reset" class="bid_button" data-auction-id="1">bid</span></td> | |
| <td><span id="auction_1_subscribe" class="subscribe_button" data-auction-id="1">subscribe</span></td> | |
| </tr> | |
| </table> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment