Meki Cherkaoui | f441d3a | 2012-04-22 15:17:52 -0700 | [diff] [blame] | 1 | /*
|
| 2 | * @author: ucla-cs
|
| 3 | * This class represents Interest Objects
|
| 4 | */
|
| 5 |
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame^] | 6 | //var ccndAddr = unescape(%E0%A0%1E%099h%F9t%0C%E7%F46%1B%AB%F5%BB%05%A4%E5Z%AC%A5%E5%8Fs%ED%DE%B8%E0%13%AA%8F);
|
| 7 | var ccndAddrHex = '%E0%A0%1E%099h%F9t%0C%E7%F46%1B%AB%F5%BB%05%A4%E5Z%AC%A5%E5%8Fs%ED%DE%B8%E0%13%AA%8F';
|
| 8 |
|
| 9 | var LOG = 5;
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 10 |
|
Meki Cherkaoui | f441d3a | 2012-04-22 15:17:52 -0700 | [diff] [blame] | 11 | // Global variables
|
| 12 | var java_socket_bridge_ready_flag = false;
|
| 13 |
|
| 14 | var ndnport =null;
|
| 15 | var ndnurl=null;
|
| 16 |
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 17 | var registeredPrefixes ={};
|
| 18 |
|
| 19 | String.prototype.trim = function() {
|
| 20 | return this.replace(/^\s+|\s+$/g, "");
|
| 21 | };
|
| 22 |
|
Meki Cherkaoui | f441d3a | 2012-04-22 15:17:52 -0700 | [diff] [blame] | 23 | // Applet reports it is ready to use
|
| 24 | function java_socket_bridge_ready(){
|
| 25 | java_socket_bridge_ready_flag = true;
|
| 26 | }
|
| 27 |
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame^] | 28 |
|
| 29 |
|
| 30 |
|
Meki Cherkaoui | f441d3a | 2012-04-22 15:17:52 -0700 | [diff] [blame] | 31 | //Sets the route to ccnx router
|
| 32 | function createRoute(url, port){
|
| 33 | ndnport = port;
|
| 34 | ndnurl=url;
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 35 |
|
| 36 | console.log(new BinaryXMLDecoder());
|
| 37 |
|
| 38 | //SEND INTERST TO CCNX NODE
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame^] | 39 |
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 40 |
|
| 41 | //Now Start the receiving thread
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 42 |
|
Meki Cherkaoui | f441d3a | 2012-04-22 15:17:52 -0700 | [diff] [blame] | 43 | }
|
| 44 |
|
| 45 | // Connect to a given url and port
|
| 46 | //Error -1 No countent found
|
| 47 | //Error -2 Empty query
|
| 48 | function queryPrefix(message){
|
| 49 | if(ndnport!=null && ndnurl!=null){
|
| 50 | var newMessage ='';
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 51 |
|
Meki Cherkaoui | f441d3a | 2012-04-22 15:17:52 -0700 | [diff] [blame] | 52 |
|
| 53 | message = message.trim();
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 | if(message==null || message =="" || message=="/"){
|
| 58 | return -2;
|
| 59 | }
|
| 60 |
|
| 61 | //message = decodeURIComponent(message);
|
Meki Cherkaoui | f441d3a | 2012-04-22 15:17:52 -0700 | [diff] [blame] | 62 |
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame^] | 63 | var array = createNameArray(message);
|
Meki Cherkaoui | f441d3a | 2012-04-22 15:17:52 -0700 | [diff] [blame] | 64 |
|
| 65 | //console.log('ARRAY IS '+ array);
|
| 66 |
|
| 67 | enc = new BinaryXMLEncoder();
|
| 68 |
|
| 69 | int = new Interest(new ContentName(array));
|
| 70 |
|
| 71 | int.encode(enc);
|
| 72 |
|
| 73 | var hex = toHex(enc.getReducedOstream());
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 | //console.log('Connecting and start '+ ndnurl +':'+ndnport+'-'+message);
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 78 |
|
| 79 |
|
Meki Cherkaoui | f441d3a | 2012-04-22 15:17:52 -0700 | [diff] [blame] | 80 | var result = get_java_socket_bridge().connectAndStart(ndnurl,ndnport,hex);
|
| 81 |
|
| 82 | console.log('BINARY RESPONSE IS ' +result);
|
| 83 |
|
| 84 |
|
| 85 | //result[0] and result[1] should be 0 and 4 if there is a content object found
|
| 86 | if(result==null || result==undefined || result =="" || result[0] != '0'||result[1]!='4'){
|
| 87 | return -1;
|
| 88 | }
|
| 89 |
|
| 90 | else{
|
| 91 |
|
| 92 | var numbers = toNumbers(result);
|
| 93 |
|
| 94 | console.log('HEX RESPONSE IS \n'+numbers);
|
| 95 | decoder = new BinaryXMLDecoder(numbers);
|
| 96 |
|
| 97 |
|
| 98 | co = new ContentObject();
|
| 99 |
|
| 100 | co.decode(decoder);
|
| 101 |
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame^] | 102 | if(LOG>2) console.log(co);
|
| 103 |
|
Meki Cherkaoui | f441d3a | 2012-04-22 15:17:52 -0700 | [diff] [blame] | 104 | return co;
|
| 105 |
|
| 106 |
|
| 107 | }
|
| 108 |
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 109 |
|
| 110 | }
|
| 111 |
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame^] | 112 |
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 113 | else{
|
| 114 |
|
| 115 | alert('ERROR URL OR PORT NOT SET');
|
| 116 |
|
| 117 | return -3;
|
| 118 |
|
| 119 | }
|
| 120 |
|
| 121 | }
|
| 122 |
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame^] | 123 | var registerStarted = false;
|
| 124 | function registerPrefix(name, content){
|
| 125 |
|
| 126 | registeredPrefixes[name] = content ;
|
| 127 |
|
| 128 | if(registerStarted == false){
|
| 129 | var result = get_java_socket_bridge().connectAndStartAndPublish();
|
| 130 |
|
| 131 | startRegisterPrefix();
|
| 132 |
|
| 133 | registerStarted = true;
|
| 134 | }
|
| 135 | sendForwardingEntry(10);
|
| 136 | }
|
| 137 |
|
| 138 |
|
| 139 | function unRegisterPrefix(name){
|
| 140 |
|
| 141 | delete registeredPrefixes[name];
|
| 142 |
|
| 143 | }
|
| 144 |
|
| 145 |
|
| 146 |
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 147 |
|
| 148 | function on_socket_received_interest(IP, port, interestBinary){
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame^] | 149 | console.log('WOOOO RECEIVED STUFF' );
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 150 | var interest = decodeHexInterest(interestBinary);
|
| 151 |
|
| 152 | console.log('WOOO received interest' + interest.Name.Components);
|
| 153 |
|
| 154 | var stringName = "";
|
| 155 |
|
| 156 | for(var i=0;i<interest.Name.Components.length;i++){
|
| 157 | stringName += "/"+ interest.Name.Components[i];
|
| 158 | }
|
| 159 |
|
| 160 | if(registeredPrefix[stringName]!=null){
|
| 161 | if(LOG>1)console.log("CANNOT FIND THE OBJECT OF NAME " + stringName );
|
| 162 | }
|
| 163 | else{
|
| 164 | var co = new ContentObject(interest.Name, null,registeredPrefix[stringName],null );
|
| 165 |
|
| 166 | var hex = encodeToHexContentObject(co);
|
| 167 |
|
| 168 | get_java_socket_bridge().sendContentObject(IP,port,hex);
|
Meki Cherkaoui | f441d3a | 2012-04-22 15:17:52 -0700 | [diff] [blame] | 169 |
|
| 170 |
|
| 171 | }
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 172 | }
|
| 173 |
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 174 |
|
| 175 |
|
| 176 |
|
| 177 | // Connect to a given url and port
|
| 178 | //Error -1 No countent found
|
| 179 | //Error -2 Empty query
|
| 180 | function startRegisterPrefix(){
|
| 181 | if(LOG>2) console.log('START REGISTER PREFIX');
|
| 182 |
|
| 183 | if(ndnport!=null && ndnurl!=null){
|
| 184 | var newMessage ='';
|
| 185 |
|
| 186 |
|
| 187 |
|
| 188 | name = name.trim();
|
| 189 |
|
| 190 |
|
| 191 |
|
| 192 | ///////////////////////
|
| 193 | var face = new FaceInstance('newface',null,null, 17, '127.0.0.1',9876,null,null,null);
|
| 194 |
|
| 195 | var encoder1 = new BinaryXMLEncoder();
|
| 196 |
|
| 197 | face.encode(encoder1);
|
| 198 |
|
| 199 | var faceInstanceBinary = encoder1.getReducedOstream();
|
| 200 |
|
| 201 |
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame^] | 202 | var si = new SignedInfo();
|
| 203 | si.setFields();
|
| 204 |
|
| 205 | var co = new ContentObject(new ContentName(),si,faceInstanceBinary,new Signature());
|
| 206 | co.sign();
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 207 |
|
| 208 | var encoder2 = new BinaryXMLEncoder();
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame^] | 209 |
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 210 | co.encode(encoder2);
|
| 211 |
|
| 212 | var coBinary = encoder2.getReducedOstream();
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame^] | 213 |
|
| 214 | //if(LOG>3)console.log('ADDESS OF CCND IS'+unescape('%E0%A0%1E%099h%F9t%0C%E7%F46%1B%AB%F5%BB%05%A4%E5Z%AC%A5%E5%8Fs%ED%DE%B8%E0%13%AA%8F'));
|
| 215 |
|
| 216 | //var interestName = new ContentName(['ccnx',co.SignedInfo.Publisher.PublisherPublicKeyDigest,'newface',coBinary]);
|
| 217 | var interestName = new ContentName(['ccnx',unescape('%E0%A0%1E%099h%F9t%0C%E7%F46%1B%AB%F5%BB%05%A4%E5Z%AC%A5%E5%8Fs%ED%DE%B8%E0%13%AA%8F'),'newface',coBinary]);
|
| 218 | //var interestName = new ContentName(['ccnx','%E0%A0%1E%099h%F9t%0C%E7%F46%1B%AB%F5%BB%05%A4%E5Z%AC%A5%E5%8Fs%ED%DE%B8%E0%13%AA%8F','newface',coBinary]);
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 219 |
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 220 | //var interestName = new ContentName(['ccnx','1234','newface',coBinary]);
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame^] | 221 | //var interestName = new ContentName(['ccnx',co.SignedInfo.Publisher.PublisherPublicKeyDigest,'newface',coBinary]);
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 222 | int = new Interest(interestName,face);
|
| 223 |
|
| 224 | var hex = encodeToHexInterest(int);
|
| 225 | /////////////////
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame^] | 226 |
|
| 227 |
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 228 |
|
| 229 | if(LOG>4)console.log('Interst name of Conntection Message is '+ interestName);
|
| 230 |
|
| 231 |
|
| 232 | if(LOG>4) console.log('Connecting and start '+ ndnurl +':'+ndnport+'-'+hex);
|
| 233 | //console.log('Connecting and start '+ ndnurl +':'+ndnport+'-'+message);
|
| 234 |
|
| 235 | var result = get_java_socket_bridge().connectAndStart(ndnurl,ndnport,hex);
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame^] | 236 |
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 237 |
|
| 238 | //TODO MOVE THIS
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 239 |
|
| 240 | //result[0] and result[1] should be 0 and 4 if there is a content object found
|
| 241 | if(result==null || result==undefined || result =="" || result[0] != '0'||result[1]!='4'){
|
| 242 | return -1;
|
| 243 | }
|
| 244 |
|
| 245 | if(LOG>4) console.log('RECEIVED THE FOLLOWING DATA: ' +co.Content);
|
| 246 |
|
| 247 | else{
|
| 248 |
|
| 249 | co = decodeHexContentObject(result);
|
| 250 |
|
| 251 | if(LOG>4) console.log('RECEIVED THE FOLLOWING DATA: ' +co.Content);
|
| 252 |
|
| 253 | return co;
|
| 254 | }
|
| 255 | }
|
Meki Cherkaoui | f441d3a | 2012-04-22 15:17:52 -0700 | [diff] [blame] | 256 | else{
|
| 257 |
|
| 258 | alert('ERROR URL OR PORT NOT SET');
|
| 259 |
|
| 260 | return -3;
|
| 261 |
|
| 262 | }
|
| 263 |
|
| 264 | }
|
| 265 |
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 266 |
|
| 267 | // Connect to a given url and port
|
| 268 | //Error -1 No countent found
|
| 269 | //Error -2 Empty query
|
| 270 | function sendForwardingEntry(faceID){
|
| 271 | if(LOG>2) console.log('START REGISTER PREFIX');
|
| 272 |
|
| 273 | if(ndnport!=null && ndnurl!=null){
|
| 274 | var newMessage ='';
|
| 275 |
|
| 276 |
|
| 277 |
|
| 278 | name = name.trim();
|
| 279 |
|
| 280 |
|
| 281 |
|
| 282 | ///////////////////////
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame^] | 283 | var face = new ForwardingEntry('prefixreg',new ContentName(['helloworld']),null, faceID, 1,null);
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 284 |
|
| 285 | var encoder1 = new BinaryXMLEncoder();
|
| 286 |
|
| 287 | face.encode(encoder1);
|
| 288 |
|
| 289 | var faceInstanceBinary = encoder1.getReducedOstream();
|
| 290 |
|
| 291 |
|
| 292 |
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame^] | 293 | var si = new SignedInfo();
|
| 294 | si.setFields();
|
| 295 |
|
| 296 | var co = new ContentObject(new ContentName(),si,faceInstanceBinary,new Signature());
|
| 297 | co.sign();
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 298 |
|
| 299 | var encoder2 = new BinaryXMLEncoder();
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame^] | 300 |
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 301 | co.encode(encoder2);
|
| 302 |
|
| 303 | var coBinary = encoder2.getReducedOstream();
|
| 304 |
|
| 305 |
|
| 306 |
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame^] | 307 | var interestName = new ContentName(['ccnx',unescape('%E0%A0%1E%099h%F9t%0C%E7%F46%1B%AB%F5%BB%05%A4%E5Z%AC%A5%E5%8Fs%ED%DE%B8%E0%13%AA%8F'),'prefixreg',coBinary]);
|
| 308 | //var interestName = new ContentName(['ccnx',co.SignedInfo.Publisher.PublisherPublicKeyDigest,'newface',coBinary]);
|
| 309 | //var interestName = new ContentName(['ccnx','%E0%A0%1E%099h%F9t%0C%E7%F46%1B%AB%F5%BB%05%A4%E5Z%AC%A5%E5%8Fs%ED%DE%B8%E0%13%AA%8F','newface',coBinary]);
|
| 310 |
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 311 | //var interestName = new ContentName(['ccnx','1234','newface',coBinary]);
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame^] | 312 | //var interestName = new ContentName(['ccnx',co.SignedInfo.Publisher.PublisherPublicKeyDigest,'prefixreg',coBinary]);
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 313 |
|
| 314 | int = new Interest(interestName,face);
|
| 315 |
|
| 316 | var hex = encodeToHexInterest(int);
|
| 317 | /////////////////
|
| 318 |
|
| 319 |
|
| 320 |
|
| 321 | if(LOG>4)console.log('Interst name of Conntection Message is '+ interestName);
|
| 322 |
|
| 323 |
|
| 324 | if(LOG>4) console.log('Connecting and start '+ ndnurl +':'+ndnport+'-'+hex);
|
| 325 | //console.log('Connecting and start '+ ndnurl +':'+ndnport+'-'+message);
|
| 326 |
|
| 327 | var result = get_java_socket_bridge().connectAndStart(ndnurl,ndnport,hex);
|
| 328 |
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame^] | 329 | if(LOG>3)console.log('BINARY RESPONSE IS ' +result);
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 330 |
|
| 331 |
|
| 332 | //result[0] and result[1] should be 0 and 4 if there is a content object found
|
| 333 | if(result==null || result==undefined || result =="" || result[0] != '0'||result[1]!='4'){
|
| 334 | return -1;
|
| 335 | }
|
| 336 |
|
| 337 | if(LOG>4) console.log('RECEIVED THE FOLLOWING DATA: ' +co.Content);
|
| 338 |
|
| 339 | else{
|
| 340 |
|
| 341 | co = decodeHexContentObject(result);
|
| 342 |
|
| 343 | if(LOG>4) console.log('RECEIVED THE FOLLOWING DATA: ' +co.Content);
|
| 344 |
|
| 345 | return co;
|
| 346 | }
|
| 347 | }
|
| 348 | else{
|
| 349 |
|
| 350 | alert('ERROR URL OR PORT NOT SET');
|
| 351 |
|
| 352 | return -3;
|
| 353 |
|
| 354 | }
|
| 355 |
|
| 356 | }
|
| 357 |
|
| 358 |
|
| 359 |
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 360 |
|
| 361 | function encodeToHexInterest(int){
|
| 362 |
|
| 363 | var enc = new BinaryXMLEncoder();
|
| 364 |
|
| 365 | int.encode(enc);
|
| 366 |
|
| 367 | var hex = toHex(enc.getReducedOstream());
|
| 368 |
|
| 369 | return hex;
|
| 370 |
|
| 371 |
|
| 372 | }
|
| 373 |
|
| 374 |
|
| 375 | function encodeToHexContentObject(co){
|
| 376 | var enc = new BinaryXMLEncoder();
|
| 377 |
|
| 378 | co.encode(enc);
|
| 379 |
|
| 380 | var hex = toHex(enc.getReducedOstream());
|
| 381 |
|
| 382 | return hex;
|
| 383 |
|
| 384 |
|
| 385 | }
|
| 386 |
|
| 387 | function decodeHexInterest(result){
|
| 388 | var numbers = toNumbers(result);
|
| 389 |
|
| 390 |
|
| 391 | decoder = new BinaryXMLDecoder(numbers);
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame^] | 392 | if(LOG>3)console.log('DECODED HEX INTERST \n'+numbers);
|
| 393 |
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 394 | i = new Interest();
|
| 395 |
|
| 396 | i.decode(decoder);
|
| 397 |
|
| 398 | return i;
|
| 399 |
|
| 400 | }
|
| 401 |
|
| 402 | function decodeHexContentObject(result){
|
| 403 | var numbers = toNumbers(result);
|
| 404 |
|
| 405 | decoder = new BinaryXMLDecoder(numbers);
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame^] | 406 | if(LOG>3)console.log('DECODED HEX CONTENT OBJECT \n'+numbers);
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 407 |
|
| 408 | co = new ContentObject();
|
| 409 |
|
| 410 | co.decode(decoder);
|
| 411 |
|
| 412 | return co;
|
| 413 |
|
| 414 | }
|
| 415 |
|
| 416 |
|
Meki Cherkaoui | f441d3a | 2012-04-22 15:17:52 -0700 | [diff] [blame] | 417 |
|
Meki Cherkaoui | f441d3a | 2012-04-22 15:17:52 -0700 | [diff] [blame] | 418 |
|
Meki Cherkaoui | f441d3a | 2012-04-22 15:17:52 -0700 | [diff] [blame] | 419 | // Get something from the socket
|
| 420 | function on_socket_get(message){}
|
| 421 |
|
| 422 | // Report an error
|
| 423 | function on_socket_error(message){
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 424 | alert('Received error message \n' +message);
|
Meki Cherkaoui | f441d3a | 2012-04-22 15:17:52 -0700 | [diff] [blame] | 425 | }
|
| 426 |
|
| 427 | // Get the applet object
|
| 428 | function get_java_socket_bridge(){
|
| 429 | return document.getElementById('JavaSocketBridge');
|
| 430 | } |