| 822 | // An invalid server message closes the connection with 4400, which is |
| 823 | // fatal for every operation on it. |
| 824 | const invalid = (reason: string, cause?: unknown) => |
| 825 | Effect.andThen( |
| 826 | Effect.ignore(writer.write(new Socket.CloseEvent(4400, "Invalid message"))), |
| 827 | Effect.fail( |
| 828 | new TransportError({ description: `Invalid graphql-ws message: ${reason}`, closeCode: 4400, cause }) |
| 829 | ) |
| 830 | ) |
| 831 | |
| 832 | const handle = (conn: Connection, frame: string | Uint8Array): Effect.Effect<void, TransportError> => { |
| 833 | // Any frame answers a keep-alive ping; an invalid one drops the connection anyway. |