BuildOnViction / victionchain

The Efficient Blockchain Powered By Proof Of Stake Voting Consensus
https://viction.xyz
GNU Lesser General Public License v3.0
168 stars 85 forks source link

rpc: Implement websockets with github.com/gorilla/websocket #401

Closed trinhdn2 closed 11 months ago

trinhdn2 commented 12 months ago

This change makes package rpc use the github.com/gorilla/websocket package for WebSockets instead of golang.org/x/net/websocket. The new library is more robust and supports all WebSocket features including continuation frames.

There are new tests for two issues with the previously-used library:

DialWebsocket's handling of the default Origin header has changed. It used to set the local machine's hostname as the origin, but that's weird and won't work with any Internet-facing service. The new behavior is creating connections without an Origin header unless one is provided explicitly.

This change also raises the request size limit for HTTP and WebSocket connections to 5 MB. Quite a few people have reported issues where geth fails to deploy contracts when they're too large, and retesteth needs a larger limit to upload the pre-state of large tests.

References: