bgp- research & experiments with border gateway protocol |
git clone git://git.acid.vegas/bgp.git |
Log | Files | Refs | Archive | README |
ris-live.js (663B)
1 /* 2 Subscribe to a RIS Live stream and output every message to the javascript console. 3 4 The exact same code will work in Node.js after running 'npm install ws' and including the following line: 5 6 const WebSocket = require('ws'); 7 */ 8 var ws = new WebSocket("wss://ris-live.ripe.net/v1/ws/?client=js-example-1"); 9 var params = { 10 moreSpecific: true, 11 host: "rrc21", 12 socketOptions: { 13 includeRaw: true 14 } 15 }; 16 ws.onmessage = function(event) { 17 var message = JSON.parse(event.data); 18 console.log(message.type, message.data); 19 }; 20 ws.onopen = function() { 21 ws.send(JSON.stringify({ 22 type: "ris_subscribe", 23 data: params 24 })); 25 };