()
| 1050 | } |
| 1051 | |
| 1052 | function overflow() { |
| 1053 | overflowed = true |
| 1054 | fail( |
| 1055 | new SocketError({ |
| 1056 | reason: new SocketReadError({ |
| 1057 | cause: new Error(`Socket highWaterMark of ${highWaterMark} bytes exceeded`) |
| 1058 | }) |
| 1059 | }) |
| 1060 | ) |
| 1061 | try { |
| 1062 | ws.close(1008, "Inbound message buffer limit exceeded") |
| 1063 | } catch { |
| 1064 | // global WebSocket clients only accept 1000 and 3000-4999 |
| 1065 | ws.close() |
| 1066 | } |
| 1067 | } |
| 1068 | |
| 1069 | function fail(err: SocketError) { |
| 1070 | if (error === undefined) error = err |