Comments (7)
Guess this is kind of related to stellar-deprecated/horizon#119, just from the client perspective. Didn’t see that one before I posted here 😬
from js-stellar-sdk.
I have this error as well, does it mean I can ignore it?
from js-stellar-sdk.
Could this be worth fixing? I have the same problem :P
from js-stellar-sdk.
Should be fixed by stellar/go#884, which will be released this week in Horizon v0.17. Closing. Please re-open if you continue having problems.
from js-stellar-sdk.
I believe this may need to be re-opened on the js-stellar-sdk
side (things look good from my stellar/go
patch).
As far as I'm aware in the specification of JS and SSE, the error
event should be of type Event
and not MessageEvent
. I still see no appropriate message bubbling on the JS side, so I would surmise this may be the underlying culprit.
You can see the documented differences here:
-
onerror(error)
should be of typeEvent
https://developer.mozilla.org/en-US/docs/Web/API/EventSource/onerror
https://developer.mozilla.org/en-US/docs/Web/API/Element/error_event
https://developer.mozilla.org/en-US/docs/Web/API/Event -
onmessage(message)
should be of typeMessageEvent
https://developer.mozilla.org/en-US/docs/Web/API/EventSource/onmessage
https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent
Specifically, if you take a look at call_builder.ts
, you'll see how the onerror
callback event gets triggered via error as MessageEvent
:
export interface EventSourceOptions<T> {
onmessage?: (value: T) => void;
onerror?: (event: MessageEvent) => void;
reconnectTimeout?: number;
}
// ... and further down ...
const createEventSource = () => {
try {
es = new EventSource(this.url.toString());
} catch (err) {
if (options.onerror) {
options.onerror(err);
}
}
createTimeout();
if (es) {
es.onmessage = (message) => {
const result = message.data
? this._parseRecord(JSON.parse(message.data))
: message;
if (result.paging_token) {
this.url.setQuery("cursor", result.paging_token);
}
clearTimeout(timeout);
createTimeout();
if (typeof options.onmessage !== "undefined") {
options.onmessage(result);
}
};
es.onerror = (error) => {
if (options.onerror) {
options.onerror(error as MessageEvent);
}
};
}
return es;
};
I'm not wholeheartedly sure which is the appropriate Event interface here to bubble the pertinent information to the user, but it would definitely be helpful to finally get this right and put the nail in the coffin.
from js-stellar-sdk.
@abuiles what are you thoughts on the best approach here?
from js-stellar-sdk.
seems to be the limit configuration in Horizon: https://github.com/stellar/go/blob/master/services/horizon/internal/handler.go (search handler.streamHandler.ServeStream)
a temporary "fix"/solution would be to add the limit param (max 200) that will give us "more time" before the connection is closed
curl -H "Accept: text/event-stream" "https://horizon.stellar.org/transactions?order=asc&cursor=now&X-Client-Name=js-stellar-sdk&X-Client-Version=3.3.0&limit=200"
from js-stellar-sdk.
Related Issues (20)
- error: XDR Read Error: attempt to read outside the boundary of the buffer HOT 2
- Enhance the fee presentation in the SDK for better clarity and usability
- Develop and add helper functions for retrieving ledger entries (getLedgerEntries)
- [Spike] Consolidate the build process to a single build tool
- [Spike] SDK Architecture Improvements HOT 1
- Issue txMalformed HOT 1
- TypeError: Bad union switch: 1 HOT 2
- Add a `SorobanRpc.Server.getWasm(contractId)` method HOT 1
- Sort Maps HOT 1
- Add yarn fmt as part of CI flow
- ledger stream onMessage: returns different type than expected
- Add support for Horizon's asynchronous transaction submission endpoint
- feature: XDR serialization of Auth Entries for multi-auth workflow
- contract client: add `sign` method, in addition to `signAndSend` HOT 1
- Use `soroban contract init` to generate contracts for `e2e tests` HOT 1
- Default Soroban signature expiration is too high HOT 2
- No Identifiers allowed after numeric literals (React Native) HOT 1
- Struct encoding fails based on entries order HOT 2
- Support `getVersionInfo` in the RPC client (`rpc.Server`)
- Support `getFeeStats` in the RPC client (`rpc.Server`)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from js-stellar-sdk.