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

@ -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 // 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: // 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") >> // << 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 // 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('error', () => self.logger.error('Websocket Error'));
self.provider.on('end', () => self.logger.error('Websocket connection ended')); self.provider.on('end', () => self.logger.error('Websocket connection ended'));