Skip to content

v0.8.0

Compare
Choose a tag to compare
@sergiu128 sergiu128 released this 15 Nov 12:39
· 50 commits to master since this release

What's Changed

API changes in codec/websocket. Might affect some websocket users.

  • Removed the Stream interface. Removed the WebsocketStream struct. NewWebsocketStream now returns a Stream struct.
  • AcquireFrame is now a Stream 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
  • Simplified the codec implementation. No API changes here.
  • Added SetMaxMessageSize to set the maximum message size per Stream. 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 means SupportsUTF8 now returns true.

Full Changelog: v0.7.0...v0.8.0