0

The following '(var es = server.tradeAggregation(base, counter, startTime, endTime, resolution, offset).cursor("now") .stream({ onmessage: callback }) ) results in a 406 error because the response content-type is application/hal+json. Eventsource specifies the the text/event-stream.

"version": "6.0.0",

Steps to reproduce the behavior:

var StellarSdk = require("stellar-sdk"); var server = new StellarSdk.Server("https://horizon.stellar.org");

var callback = function (resp) { console.log(resp); };

var base = new StellarSdk.Asset.native(); var counter = new StellarSdk.Asset( "EURT", "GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", ); var startTime = 1582156800000; var endTime = 1582178400000; var resolution = 3600000; var offset = 0;

var es = server .tradeAggregation(base, counter, startTime, endTime, resolution, offset) .cursor("now") .stream({ onmessage: callback })

returns Eventsource which needs to be of type text/event-stream as you can see streaming orderbooks:

var es = server .orderbook( new StellarSdk.Asset.native(), new StellarSdk.Asset( "BB1", "GD5J6HLF5666X4AZLTFTXLY46J5SW7EXRKBLEYPJP33S33MXZGV6CWFN", ), ) .cursor("now") .stream({ onmessage: callback });

Expected behavior Response content should be text/event-stream as defined in the eventsource specification (look also here: https://developer.mozilla.org/en-US/docs/Web/API/EventSource)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.