8.2.0
·
3 commits
to master
since this release
May 28 2026
Added
Config.UseHTTP2now defaults totrueandNewHTTP2Clientis rebuilt onnet/http.TransportwithForceAttemptHTTP2+http2.ConfigureTransport, so HTTPS connections prefer HTTP/2 via TLS ALPN and fall back to HTTP/1.1 when the origin doesn't advertise h2. The single subscribe loop reuses the cached*http.Clientacross long-poll cycles, and onSubscriptionManager.reconnectSDK-managed clients are dropped so the next request re-runs TLS+ALPN — user-supplied clients pinned viaSetClient/SetSubscribeClientare preserved. SetUseHTTP2 = falseto opt out.- Network response log messages now carry the
OperationTypeand the negotiated protocol from*http.Response.Proto. The formatted line becomesPubNub request completed: operation=<Op> protocol=<HTTP/x.y> status=<n> url=<…> body=<…>, and the value is also retained on thePubNubinstance aslastNegotiatedProtofor internal use. No public API change.
Fixed
Destroypreviously dereferencedpn.clientunconditionally, read the field without holdingpn.Lock, and never closedpn.subscribeClient(most impactful on HTTP/2 where one long-lived session per origin holds the only physical connection). The newcloseManagedHTTPClientssnapshots both clients underpn.Lock, clears the pointers, and callsCloseIdleConnectionsoutside the lock on whichever clients are non-nil.
Modified
- Add a generic
eventuallypolling test helper and update the gotestsum-based runner to automatically retry failing tests up to 3 times.