v0.8.0
What's Changed
API changes in codec/websocket
. Might affect some websocket users.
- Removed the
Stream
interface. Removed theWebsocketStream
struct.NewWebsocketStream
now returns aStream
struct. AcquireFrame
is now aStream
method, not a global method anymore.ReleaseFrame
has been removed.- Users who wish to sends frames to the server must do it like so:
f := stream.AcquireFrame() // comes from a sync.Pool
f.SetFIN().SetPayload() // ...etc
stream.AsyncWriteFrame(f, ...)
// the frame is automatically released to the sync.Pool by the stream after the write completes
// the stream takes care to automatically mask the frame before sending it to the server
- Revised the implementation of
Frame
- it is now just a type alias to a byte slice, instead of a struct with 3 members:
header | mask | payload
- the setter methods like
SetFIN, SetPong etc
are now using the builder pattern
- it is now just a type alias to a byte slice, instead of a struct with 3 members:
- Simplified the
codec
implementation. No API changes here. - Added
SetMaxMessageSize
to set the maximum message size perStream
. Previously this was a global object, so all streams respected the set size.stream.MaxMessageSize
returns the currently set size - defaults to 512KB. - Added
ValidateUTF8(bool)
to optionally validate payloads as UTF-8 encoded per stream.ValidatesUTF8
returns whether validation is done on each frame or not. Not done by default. This also meansSupportsUTF8
now returnstrue
.
Full Changelog: v0.7.0...v0.8.0