fix(ws): up fragmentation threshold to patch Geth bug with WS

This commit is contained in:
Jonathan Rainville 2018-12-21 11:12:56 -05:00 committed by Iuri Matias
parent f2d6f609ba
commit b20bce9880
1 changed files with 8 additions and 2 deletions

View File

@ -44,7 +44,13 @@ class Provider {
// 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}});
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'));