Skip to content

Release v0.2.0

Compare
Choose a tag to compare
@github-actions github-actions released this 17 Feb 15:29
· 40 commits to main since this release
v0.2.0
1f590b7

0.2.0 - 2022-02-17

This release is a breaking change from the 0.1.0 series. This update removes
all instances where Mint.WebSocket would access opaque t:Mint.HTTP.t/0 fields
or call private functions within Mint.HTTP1, so now Mint.WebSocket should be
more compatible with future changes to Mint.

Upgrade guide

First, add the scheme argument to calls to Mint.WebSocket.upgrade/5.
For connections formed with Mint.HTTP.connect(:http, ..), use the :ws
scheme. For Mint.HTTP.connect(:https, ..), use :wss.

- Mint.WebSocket.upgrade(conn, path, headers)
+ Mint.WebSocket.upgrade(scheme, conn, path, headers)

Then replace calls to Mint.HTTP.stream/2 and/or Mint.HTTP.recv/3 and
Mint.HTTP.stream_request_body/3 with the new Mint.WebSocket wrappers.
This is safe to do even when these functions are being used to send and
receive data in normal HTTP requests: the functionality only changes when
the connection is an established HTTP/1 WebSocket.

Added

  • Added Mint.WebSocket.stream/2 which wraps Mint.HTTP.stream/2
  • Added Mint.WebSocket.recv/3 which wraps Mint.HTTP.recv/3
  • Added Mint.WebSocket.stream_request_body/3 which wraps Mint.HTTP.stream_request_body/3

Changed

  • Changed function signature of Mint.Websocket.upgrade/5 to accept the
    WebSocket's scheme (:ws or :wss) as the first argument
  • Added an optional opts argument to Mint.WebSocket.new/5 to control
    active vs. passive mode on the socket
  • Restricted compatible Mint versions to ~> 1.4
    • Mint.WebSocket now uses Mint.HTTP.get_protocol/1 which was
      introduced in 1.4.0.