Repository navigation
This patch release fixes connection initialization races that could silently drop early Socket.IO CONNECT packets, and corrects HTTP response lifecycle handling during asynchronous polling.
Bug fixes
- Fix early inbound packets being dropped before Engine.IO and Socket.IO listeners are registered. WebSocket and WebTransport readers now start after connection initialization, or after probe listeners are installed during upgrades. Heartbeat startup follows the same initialization boundary. (#195)
- Initialize and bind Engine.IO before publishing the Socket.IO handler or starting its HTTP listener.
- Keep HTTP handlers alive until active response preparation and writing complete, including cancellation, explicit finalization, and asynchronous polling overrides. This prevents access to an HTTP response after its handler returns, including on HTTP/2.
- Correct polling request ownership during cancellation and overlapping requests, preventing delayed cleanup from affecting a successor request. Ensure graceful closure can send its final packet before the write queue shuts down.
- Honor custom server overrides during middleware execution, verification, ID generation, handshakes, and transport creation. Skip verification when middleware resumes after request cancellation.
- Correct WebTransport transport selection and restrict it to Engine.IO v4 sessions. Preserve the supplied WebTransport server's origin policy instead of overwriting it.
Maintenance
- Simplify HTTP context lifecycle handling, metadata caching, and polling compression paths.
- Add
HttpContext.BeginResponse()andEndResponse()for asynchronous HTTP integrations. - Expand regression coverage for initialization deadlines, cancellation, callback reentrancy, custom transports, and HTTP/1 and HTTP/2 response lifetimes.
- Bind network test fixtures and the CI Redis service to loopback addresses.
Upgrade notes
- Go 1.26 or newer remains required. Update the Socket.IO modules used by your application together to v3.0.6.
- Built-in transports and custom builders that delegate to their constructors require no additional startup calls. Fully custom stream readers should use
transports.StartReaderto participate in initialization ordering. UpgradeTimeoutalso bounds WebSocket and WebTransport initialization, with a default of 10 seconds. Non-positive values expire immediately. Connection initialization callbacks should return promptly and must not wait for inbound packets; the timeout cannot interrupt arbitrary application code.- Custom asynchronous polling
DoWriteimplementations must invoke their completion callback exactly once, after their last response or header access. Usectx.Context().Done()to observe cancellation;ctx.Done()waits for response operations to finish. Polling request cleanup is managed by the base transport. - Cross-origin WebTransport connections must be allowed by both Engine.IO CORS and
webtransport.Server.CheckOrigin. Configure the latter before serving.
See the Engine.IO documentation for initialization and custom transport guidance.
Full changelog: v3.0.5...v3.0.6