Skip to content

Commit

Permalink
fix(ws): up fragmentation threshold to patch Geth bug with WS
Browse files Browse the repository at this point in the history
  • Loading branch information
jrainville authored and iurimatias committed Dec 21, 2018
1 parent f2d6f60 commit b20bce9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/lib/modules/blockchain_connector/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,14 @@ class Provider {
// to protect user, it has no meaning if it is used server-side. See here for more details: https://github.com/ethereum/go-ethereum/issues/16608
// Moreover, Parity reject origins that are not urls so if you try to connect with Origin: "embark" it gives the following error:
// << Blocked connection to WebSockets server from untrusted origin: Some("embark") >>
// The best choice is to use void origin, BUT Geth rejects void origin, so to keep both clients happy we can use http://embark
self.provider = new this.web3.providers.WebsocketProvider(self.web3Endpoint, {headers: {Origin: constants.embarkResourceOrigin}});
// The best choice is to use void origin, BUT Geth rejects void origin, so to keep both clients happy we can use http://embark
self.provider = new this.web3.providers.WebsocketProvider(self.web3Endpoint, {
headers: {Origin: constants.embarkResourceOrigin},
// TODO remove this when Geth fixes this: https://github.com/ethereum/go-ethereum/issues/16846
clientConfig: {
fragmentationThreshold: 81920
}
});

self.provider.on('error', () => self.logger.error('Websocket Error'));
self.provider.on('end', () => self.logger.error('Websocket connection ended'));
Expand Down

0 comments on commit b20bce9

Please sign in to comment.