I am trying to learn about websockets, and I am not sure I understand what exactly Upgrader does in gorilla/websockets.
http://www.gorillatoolkit.org/pkg/websocket#Upgrader
Can someone please explain in simple terms what exactly the buffer sizes mean?
The Upgrader.Upgrade method upgrades the HTTP server connection to the WebSocket protocol as described in the WebSocket RFC. A summary of the process is this: The client sends an HTTP request requesting that the server upgrade the connection used for the HTTP request to the WebSocket protocol. The server inspects the request and if all is good the server sends an HTTP response agreeing to upgrade the connection. From that point on, the client and server use the WebSocket protocol over the network connection.
Applications use Upgrader fields to specify options for the upgrade operation.
The WebSocket connection buffers reads and writes to the underlying network connection. The ReadBufferSize and WriteBufferSize specifies the size of these buffers. It's usually best to use the default size by setting ReadBufferSize and WriteBufferSize to zero. Larger buffer sizes take more memory. Smaller buffer sizes can result in more calls to the underlying network connection. The buffer sizes do not limit the size of a message that can be read.