diff --git a/close_notjs.go b/close_notjs.go index 4251311d..58a75efb 100644 --- a/close_notjs.go +++ b/close_notjs.go @@ -73,7 +73,7 @@ func (c *Conn) writeClose(code StatusCode, reason string) error { } } - writeErr := c.writeControl(context.Background(), opClose, p) + writeErr := c.writeControl(c.msgWriterState.ctx, opClose, p) if CloseStatus(writeErr) != -1 { // Not a real error if it's due to a close frame being received. writeErr = nil