- Timestamp:
- 02/06/08 18:38:10 (4 years ago)
- Location:
- web
- Files:
-
- 1 added
- 3 modified
-
client.html (modified) (1 diff)
-
js/jquery.comet.js (modified) (4 diffs)
-
js/json2.js (added)
-
js/poker-client.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
web/client.html
r34 r35 6 6 <script type="text/javascript" src="js/jquery.comet.js"></script> 7 7 <script type="text/javascript" src="js/poker-client.js"></script> 8 <script type="text/javascript" src="js/json2.js"></script> 8 9 <body> 9 10 <div id="status"> </div> -
web/js/jquery.comet.js
r34 r35 130 130 { 131 131 $.ajax({ 132 url: sUrl ,132 url: sUrl+'?jsonp=?', 133 133 type: 'post', 134 134 beforeSend: function(oXhr) { oXhr.setRequestHeader('Connection', 'Keep-Alive'); }, 135 data: { message: JSON.stringify( oMsg) },135 data: { message: JSON.stringify([oMsg]) }, 136 136 success: fCallback 137 137 }); … … 140 140 { 141 141 $.ajax({ 142 url: sUrl ,142 url: sUrl+'?jsonp=?', 143 143 dataType: 'jsonp', 144 144 beforeSend: function(oXhr) { oXhr.setRequestHeader('Connection', 'Keep-Alive'); }, 145 145 data: 146 146 { 147 message: JSON.stringify( $.extend(oMsg,{connectionType: 'callback-polling' }))147 message: JSON.stringify([$.extend(oMsg,{connectionType: 'callback-polling' })]) 148 148 }, 149 149 success: fCallback … … 180 180 { 181 181 this._sUrl = (sUrl) ? sUrl : '/cometd'; 182 183 182 this._oTransport = new oTransport(); 184 183 … … 210 209 $.comet._oTransport._comet = $.comet; 211 210 $.comet._oTransport.version = $.comet.version; 212 213 211 $.comet.clientId = oReturn.clientId; 214 212 $.comet._oTransport.startup(oReturn); -
web/js/poker-client.js
r27 r35 110 110 111 111 function makeRequest( data ) { 112 $.getJSON(host, 113 data, 114 updateStatus ) 112 $.comet.publish("/poker",data); 113 $.comet.endBatch(); 114 115 //$.getJSON(host, 116 // data, 117 // updateStatus ) 115 118 n_requests += 1; 116 119 } … … 184 187 //$("form#connect_form").hide(); 185 188 // 189 $.comet.init("http://localhost:8080") 190 $.comet.subscribe("/poker") 191 192 sel = $('selector') 193 sel.bind("/poker", function(event, data) {alert(data)}); 186 194 baseplayer = $("td#baseplayer"); 187 195 baseplayer.parent().parent().remove(); … … 194 202 table_name = this.table_name.value; 195 203 user_id = this.user_id.value; 196 host = this.host.value + "?jsoncallback=?";204 //host = this.host.value + "?jsoncallback=?"; 197 205 client_id = this.client_id.value; 198 206 state = "connecting";
