diff --git a/conn.go b/conn.go index ab37248eb3144998575d171ce76b31fc4d51c5d9..17a6b9666dba86a54f682f251f8a7f33515c18c6 100644 --- a/conn.go +++ b/conn.go @@ -42,6 +42,8 @@ const ( // This applies to context expirations as well unfortunately. // See https://github.com/nhooyr/websocket/issues/242#issuecomment-633182220 type Conn struct { + noCopy + subprotocol string rwc io.ReadWriteCloser client bool @@ -288,3 +290,6 @@ func (m *mu) unlock() { default: } } + +type noCopy struct{} +func (*noCopy) Lock() {} diff --git a/ws_js.go b/ws_js.go index 3248933c0195043e618f97296c4bf1e8cb10d8de..05f2202e20e5f1d635d177ab3bebfeb7ce520982 100644 --- a/ws_js.go +++ b/ws_js.go @@ -40,6 +40,7 @@ const ( // Conn provides a wrapper around the browser WebSocket API. type Conn struct { + noCopy ws wsjs.WebSocket // read limit for a message in bytes. @@ -563,3 +564,6 @@ func (m *mu) unlock() { default: } } + +type noCopy struct{} +func (*noCopy) Lock() {}