Skip to content

Commit b20bce9

Browse files
jrainvilleiurimatias
authored andcommitted
fix(ws): up fragmentation threshold to patch Geth bug with WS
1 parent f2d6f60 commit b20bce9

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/lib/modules/blockchain_connector/provider.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,14 @@ class Provider {
4343
// 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
4444
// Moreover, Parity reject origins that are not urls so if you try to connect with Origin: "embark" it gives the following error:
4545
// << Blocked connection to WebSockets server from untrusted origin: Some("embark") >>
46-
// The best choice is to use void origin, BUT Geth rejects void origin, so to keep both clients happy we can use http://embark
47-
self.provider = new this.web3.providers.WebsocketProvider(self.web3Endpoint, {headers: {Origin: constants.embarkResourceOrigin}});
46+
// The best choice is to use void origin, BUT Geth rejects void origin, so to keep both clients happy we can use http://embark
47+
self.provider = new this.web3.providers.WebsocketProvider(self.web3Endpoint, {
48+
headers: {Origin: constants.embarkResourceOrigin},
49+
// TODO remove this when Geth fixes this: https://github.com/ethereum/go-ethereum/issues/16846
50+
clientConfig: {
51+
fragmentationThreshold: 81920
52+
}
53+
});
4854

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

0 commit comments

Comments
 (0)