To confirm, you are wanting to send a 1GB file in a single WebSocket message?
There are two strategies here.
1. Application layer chunking: Decide that you will chop any file larger than x bytes into chunks. Send an initial metadata message with your chunk sizes (or wrap with start/fin messages).
2. WebSocket layer fragmentation: The WebSocket protocol allows for sending messages too large to buffer (or of unknown size when the first byte is sent) by splitting the message into separate frames which are automatically reassembled on the other end.
Presently WebSocket++ supports receiving fragmented messages (but they are still fully buffered on the receiving end). It does not support sending fragmented messages (feature tracked here:
https://github.com/zaphoyd/websocketpp/issues/111) or directly receiving fragments before the message is complete (feature tracked here:
https://github.com/zaphoyd/websocketpp/issues/34). This is the same behavior of all modern web browsers, so if you are using a browser as a client anywhere you’ll likely run into this issue as well on that end.
I do hope to implement fragmented send at some point, as it will be useful for some of the WebSocket load testing software I am working on. I presently have little interest in a frame based receive API as I don’t believe that the benefits outweigh the additional complexity. As mentioned in issue #160, both of these features are invasive to implement and I feel like there are more important features and fixes outstanding at the moment. I am open to discussion this issue.