From 6f562794db6ff9685f7715ebf87a3eed3a1b97cd Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 16 Mar 2023 07:28:17 +0000 Subject: [PATCH] =?UTF-8?q?chore(release):=20=F0=9F=8E=89=201.0.0=20[skip?= =?UTF-8?q?=20ci]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # 1.0.0 (2023-03-16) ### Bug Fixes * Add `browser` export map ([ea306db](https://github.com/ilijaNL/graphql-ws/commit/ea306db45a05ab712782b17c5a3a1ec60537eaa4)) * Add `package.json` to exports map ([#119](https://github.com/ilijaNL/graphql-ws/issues/119)) ([1f09863](https://github.com/ilijaNL/graphql-ws/commit/1f09863de6b8731980dfc513708cd144a0d5bfbe)), closes [#118](https://github.com/ilijaNL/graphql-ws/issues/118) * Add `uWebSockets` exports path ([36247cb](https://github.com/ilijaNL/graphql-ws/commit/36247cbce31b6d049a58622df58a9b5fb3dafbd6)), closes [#155](https://github.com/ilijaNL/graphql-ws/issues/155) * Add support for `graphql@v16` ([ad5aea2](https://github.com/ilijaNL/graphql-ws/commit/ad5aea2703d8612a8f5b16814864268fd7f3feb6)) * add the sink to the subscribed map AFTER emitting a subscribe message ([814f46c](https://github.com/ilijaNL/graphql-ws/commit/814f46c119792aaa240d0fcdb318dccdd1cc0e87)) * Add types path to package.json `exports` ([#375](https://github.com/ilijaNL/graphql-ws/issues/375)) ([9f394d7](https://github.com/ilijaNL/graphql-ws/commit/9f394d7a8b70c1d6b2cfe6d30ba7e0777d578181)) * **client:** `complete` should not be called after subscription `error` ([1fba419](https://github.com/ilijaNL/graphql-ws/commit/1fba4196306991eab1ca74d710adb66e894692a0)) * **client:** `ConnectionInit` payload is absent if `connectionParams` returns nothing ([98f8265](https://github.com/ilijaNL/graphql-ws/commit/98f8265967aba43d206b3fffe2405f121d9c49b3)) * **client:** `isFatalConnectionProblem` defaults to undefined for using `shouldRetry` ([9d5c573](https://github.com/ilijaNL/graphql-ws/commit/9d5c5733ba8bb181ef4f2051da958d80786c9ee6)) * **client:** Accept nullish values for `operationName` and `variables` ([2d60dda](https://github.com/ilijaNL/graphql-ws/commit/2d60dda93c09b0c8d7b69241833174f991d7b450)) * **client:** cant read the `CloseEvent.reason` after bundling so just pass the whole event to the sink error and let the user handle it ([9ccb46b](https://github.com/ilijaNL/graphql-ws/commit/9ccb46bc80024cb2de823702d2bd308052c6c516)) * **client:** Close event's `wasClean` is not necessary ([2c65f0e](https://github.com/ilijaNL/graphql-ws/commit/2c65f0ee91a6372a9c2935183d9be0be50f40663)), closes [#81](https://github.com/ilijaNL/graphql-ws/issues/81) * **client:** Close with error message during connecting issues ([f8ecdd7](https://github.com/ilijaNL/graphql-ws/commit/f8ecdd78e200a6a752ec1e72fb14d83e6103dd02)) * **client:** Connection locks dont increment on retries ([1e7bd97](https://github.com/ilijaNL/graphql-ws/commit/1e7bd97d47525040dd88803039b17f77db1c6c2a)), closes [#153](https://github.com/ilijaNL/graphql-ws/issues/153) * **client:** Debounce close by `lazyCloseTimeout` ([c332837](https://github.com/ilijaNL/graphql-ws/commit/c332837c50da09174a9741a1903a5471f8a1c42d)), closes [#388](https://github.com/ilijaNL/graphql-ws/issues/388) * **client:** Dispose of subscription on complete or error messages ([#23](https://github.com/ilijaNL/graphql-ws/issues/23)) ([fb4d8e9](https://github.com/ilijaNL/graphql-ws/commit/fb4d8e9efdfdd0cbe3b7cc34ddadbad3a795ae35)) * **client:** Distinguish client connection closes ([ed4d9db](https://github.com/ilijaNL/graphql-ws/commit/ed4d9db0fdf722a98ed8e95d9f5af6ae952acd20)) * **client:** Don't complete after connection error ([5f829c3](https://github.com/ilijaNL/graphql-ws/commit/5f829c36a73e6e8566247d62e2ea395e6d18d8eb)) * **client:** Export relevant elements from the browser bundle ([b106dbe](https://github.com/ilijaNL/graphql-ws/commit/b106dbed1440488692a5588dcfd73f2f5a855a74)), closes [#97](https://github.com/ilijaNL/graphql-ws/issues/97) * **client:** Lazy connects after successful reconnects are not retries ([99b85a3](https://github.com/ilijaNL/graphql-ws/commit/99b85a3bebfdc4fada03e6c71c2703807ac6d3cd)) * **client:** Limit client emitted error close message size ([2d959f6](https://github.com/ilijaNL/graphql-ws/commit/2d959f61c9cf0119cd4b20f843dd82fe584141a6)) * **client:** New `error` event listener for handling connection errors ([#136](https://github.com/ilijaNL/graphql-ws/issues/136)) ([127b69f](https://github.com/ilijaNL/graphql-ws/commit/127b69fa5df8765a4a17a928191baa6c85985409)), closes [#135](https://github.com/ilijaNL/graphql-ws/issues/135) * **client:** No retries when disposed ([0d5e6c2](https://github.com/ilijaNL/graphql-ws/commit/0d5e6c259eee5e331c5cef92246888745edda5a4)) * **client:** One cleanup per subscription ([#67](https://github.com/ilijaNL/graphql-ws/issues/67)) ([5a5ae4d](https://github.com/ilijaNL/graphql-ws/commit/5a5ae4d01afd0c9aa51090342d7f699daf4fbafc)) * **client:** Only `query` is required in the subscribe payload ([e892530](https://github.com/ilijaNL/graphql-ws/commit/e892530b37108a210976e416b2f5eb3004be7ad3)) * **client:** Reduce WebSocket event listeners and add new client `message` event ([#104](https://github.com/ilijaNL/graphql-ws/issues/104)) ([68d0e20](https://github.com/ilijaNL/graphql-ws/commit/68d0e20674488e8792a61d07f068233d78acaa3a)), closes [#102](https://github.com/ilijaNL/graphql-ws/issues/102) * **client:** Report close causing internal errors to error listeners ([4e7e389](https://github.com/ilijaNL/graphql-ws/commit/4e7e3896e62c934ac9301518fb410d23ae9a8bb8)) * **client:** Report close error even if `Complete` message followed ([27754b2](https://github.com/ilijaNL/graphql-ws/commit/27754b213fe4be3f7a918a0881700cf91825048e)), closes [#245](https://github.com/ilijaNL/graphql-ws/issues/245) * **client:** Return ping's payload through the response pong ([ee6193a](https://github.com/ilijaNL/graphql-ws/commit/ee6193a6b789124f903b4688df8a6c680bbadc81)) * **client:** send complete message and close only if socket is still open ([49b75ce](https://github.com/ilijaNL/graphql-ws/commit/49b75cec60fec9c8a42119b124a9c54d29d30308)) * **client:** Should emit `closed` event when disposing ([5800de8](https://github.com/ilijaNL/graphql-ws/commit/5800de8d343649bb4c93ca31c61911879123c736)), closes [#108](https://github.com/ilijaNL/graphql-ws/issues/108) * **client:** Shouldn't reconnect if all subscriptions complete while waiting for retry ([2826c10](https://github.com/ilijaNL/graphql-ws/commit/2826c103a2f5786575157c6aa9cbd270746b57ca)), closes [#163](https://github.com/ilijaNL/graphql-ws/issues/163) * **client:** Shouldn’t send the `Complete` message if socket is not open ([cd12024](https://github.com/ilijaNL/graphql-ws/commit/cd12024c19bdcf859c5a9a6b7a072ea252401524)) * **client:** Some close events are not worth retrying ([4d9134b](https://github.com/ilijaNL/graphql-ws/commit/4d9134b8704446f0b2674c71e25d7c6c44000c9a)) * **client:** Specify and fail on fatal internal WebSocket close codes ([a720125](https://github.com/ilijaNL/graphql-ws/commit/a7201251ee4d090e2bd3e55e8e50dbc1501231a0)) * **client:** Stabilize and simplify internals ([#100](https://github.com/ilijaNL/graphql-ws/issues/100)) ([5ff8f1d](https://github.com/ilijaNL/graphql-ws/commit/5ff8f1dfb34d1a063fdfff8893c789c8b2c60d6e)), closes [#99](https://github.com/ilijaNL/graphql-ws/issues/99) [#85](https://github.com/ilijaNL/graphql-ws/issues/85) * **client:** Stop execution if `connectionParams` took too long and the server kicked the client off ([1e94e45](https://github.com/ilijaNL/graphql-ws/commit/1e94e45d51b13bd870273a63e33819055209f607)), closes [#331](https://github.com/ilijaNL/graphql-ws/issues/331) * **client:** Subscribes even if socket is in CLOSING state due to all subscriptions being completed ([3e3b8b7](https://github.com/ilijaNL/graphql-ws/commit/3e3b8b771d571f9beaee72d22481aac976af663e)), closes [#173](https://github.com/ilijaNL/graphql-ws/issues/173) [#170](https://github.com/ilijaNL/graphql-ws/issues/170) * **client:** Subscription can be disposed only once ([abd9c28](https://github.com/ilijaNL/graphql-ws/commit/abd9c28a9d2c43de9babb3488d7cb9eb7f3d3e15)), closes [#170](https://github.com/ilijaNL/graphql-ws/issues/170) * **client:** Subscriptions acquire locks ([eb6cb2a](https://github.com/ilijaNL/graphql-ws/commit/eb6cb2a0654489e1210a8db93f90bfc3ebfe94e4)) * **client:** Time retries and socket change waits ([7c707db](https://github.com/ilijaNL/graphql-ws/commit/7c707db3c8c3b1991a7e1b95a225efd8d58d5615)), closes [#85](https://github.com/ilijaNL/graphql-ws/issues/85) * **client:** Wait for server acknowledgement indefinitely ([a4bd602](https://github.com/ilijaNL/graphql-ws/commit/a4bd6029916e26a48b3f1acbbf9d741775e34baa)), closes [#98](https://github.com/ilijaNL/graphql-ws/issues/98) * Close the details tag in the README ([84144c4](https://github.com/ilijaNL/graphql-ws/commit/84144c4c958674c4549cc48e84563bcb9f7c5e9d)) * correctly detect WebSocket server ([eab29dc](https://github.com/ilijaNL/graphql-ws/commit/eab29dcae3d031a117de37dee09770833e9573cf)) * Define entry points through the `exports` field and use `.mjs` suffixed ESM imports ([#110](https://github.com/ilijaNL/graphql-ws/issues/110)) ([4196238](https://github.com/ilijaNL/graphql-ws/commit/4196238888bffe4fb958bc665512b79eb384a28e)) * Define graphql execution results ([a64c91b](https://github.com/ilijaNL/graphql-ws/commit/a64c91bbfab8433e8fec2a32a64ee4d402f182c6)) * Drop TypeScript DOM lib dependency ([a81e8c1](https://github.com/ilijaNL/graphql-ws/commit/a81e8c1ea080984ddd6d5e58c154b866ee44c14c)) * export both the client and the server from index ([29923b1](https://github.com/ilijaNL/graphql-ws/commit/29923b1e35a462c5b5a19d64603d59f25c1c5987)) * Export useful types ([e4cc4d4](https://github.com/ilijaNL/graphql-ws/commit/e4cc4d4df8efb77aed14053a32af3464dc2a95db)) * **fastify-websocket:** Handle connection and socket emitted errors ([71e9586](https://github.com/ilijaNL/graphql-ws/commit/71e9586247e91a307b1b401667c8e9f2bb42d932)) * **fastify-websocket:** Handle server emitted errors ([3fa17a7](https://github.com/ilijaNL/graphql-ws/commit/3fa17a704689da41d66a1934d1aa09a305e01d9f)) * http and ws have no default exports ([5c01ed9](https://github.com/ilijaNL/graphql-ws/commit/5c01ed924793ce17f036d26d9d5d63cd5cecc6aa)) * include `types` file holding important types ([f3e4edf](https://github.com/ilijaNL/graphql-ws/commit/f3e4edf96e5c6cecf025811e2beb7ecc324ea962)) * Main entrypoint in `exports` is just `"."` ([8f70b02](https://github.com/ilijaNL/graphql-ws/commit/8f70b02ec1ed1b88fd80e7e04eecf4552b382bbc)) * **message:** Allow `data` field to be of any type ([533248e](https://github.com/ilijaNL/graphql-ws/commit/533248e0bcfd857c7960c9e8671cbd300788ad7d)), closes [#72](https://github.com/ilijaNL/graphql-ws/issues/72) * **message:** Allow `payload` field to be of any type for `NextMessage` ([7cebbfe](https://github.com/ilijaNL/graphql-ws/commit/7cebbfe00dc3c360e80e8962f345a28743b49c1f)), closes [#72](https://github.com/ilijaNL/graphql-ws/issues/72) * Node 10 is the min supported version ([19844d7](https://github.com/ilijaNL/graphql-ws/commit/19844d72f4638f9f7126870f9d9a744cdb4814c4)) * notify only relevant sinks about errors or completions ([62155ba](https://github.com/ilijaNL/graphql-ws/commit/62155ba0b79516141633b86765921b2401fcc2ed)) * Only UMD build has side effects ([66ed43f](https://github.com/ilijaNL/graphql-ws/commit/66ed43fe60b57fa268490aec07c3254b06ab3473)) * Reorder types paths in package.json for better import resolution ([#406](https://github.com/ilijaNL/graphql-ws/issues/406)) ([37263c5](https://github.com/ilijaNL/graphql-ws/commit/37263c51f4c6e92e4955df5058b76f452b2d0399)) * reset connected/connecting state when disconnecting and disposing ([2eb3cd5](https://github.com/ilijaNL/graphql-ws/commit/2eb3cd5965cf34f6d6b21748daea520163b9c789)) * **server:** `handleProtocols` accepts arrays too and gracefully rejects other types ([98dec1a](https://github.com/ilijaNL/graphql-ws/commit/98dec1addb59c2a215cb4425a4927c5f33a78b4c)), closes [#318](https://github.com/ilijaNL/graphql-ws/issues/318) * **server:** `onDisconnect` is called exclusively if the connection is acknowledged ([33ed5f2](https://github.com/ilijaNL/graphql-ws/commit/33ed5f227a787773a6661d4e5efce1be5e500525)) * **server:** `return` instead of `break` at switch case ends ([e9447e4](https://github.com/ilijaNL/graphql-ws/commit/e9447e45cfa572982e7fe0ffa32a113feac06b94)), closes [#140](https://github.com/ilijaNL/graphql-ws/issues/140) * **server:** `subscription` operations are distinct on the message ID ([#24](https://github.com/ilijaNL/graphql-ws/issues/24)) ([dfffb05](https://github.com/ilijaNL/graphql-ws/commit/dfffb0502be5dd9ab5598e785b9988b1f4000227)) * **server:** allow skipping init message wait with zero values ([a7419df](https://github.com/ilijaNL/graphql-ws/commit/a7419df077acb018418016c7a06716fb3c054ddb)) * **server:** Async iterator must implement `return` ([d99982b](https://github.com/ilijaNL/graphql-ws/commit/d99982b1fc887d913cb1b3a031b1c5c3706b4a35)), closes [#149](https://github.com/ilijaNL/graphql-ws/issues/149) * **server:** Client can complete/cancel any operation ([0ad1c4c](https://github.com/ilijaNL/graphql-ws/commit/0ad1c4c174d13effc185de49b42c64cdfd54a7ec)) * **server:** Close socket if `onSubscribe` returns invalid array ([#53](https://github.com/ilijaNL/graphql-ws/issues/53)) ([0464a54](https://github.com/ilijaNL/graphql-ws/commit/0464a54eee09dfdf66d65bf539a4d8f596be2697)) * **server:** Consistently set `rootValue` and `contextValue`, if not overridden ([#49](https://github.com/ilijaNL/graphql-ws/issues/49)) ([7aa3bcd](https://github.com/ilijaNL/graphql-ws/commit/7aa3bcdd38d40e83306f867a5b6b1bd612ec5fe3)) * **server:** Distribute server error to all clients even if one error listener throws ([#56](https://github.com/ilijaNL/graphql-ws/issues/56)) ([b96dbb9](https://github.com/ilijaNL/graphql-ws/commit/b96dbb98bb6f71956321ce1202af0af50df4e40e)) * **server:** Don't surface bad request error details in production ([#55](https://github.com/ilijaNL/graphql-ws/issues/55)) ([70317b2](https://github.com/ilijaNL/graphql-ws/commit/70317b2619b7729e5d5556b4e5388f142414b082)) * **server:** Enforce ID uniqueness across all operations and during the whole subscription life ([#96](https://github.com/ilijaNL/graphql-ws/issues/96)) ([65d1bfa](https://github.com/ilijaNL/graphql-ws/commit/65d1bfa876fa5ff724c736b7ce958a1b1c9b0dc3)) * **server:** Handle upgrade requests with multiple subprotocols and omit `Sec-WebSocket-Protocol` header if none supported ([9bae064](https://github.com/ilijaNL/graphql-ws/commit/9bae06437d6dc37c6dbafa18f905e27659a12da2)) * **server:** Hide internal server error messages from the client in production ([36fe405](https://github.com/ilijaNL/graphql-ws/commit/36fe405e0e7d5942f858073797cc85bb41739a1d)), closes [#31](https://github.com/ilijaNL/graphql-ws/issues/31) * **server:** Init context first on connection open ([a80e753](https://github.com/ilijaNL/graphql-ws/commit/a80e7534cc0570fa111e15f196ba53fdb5ced667)), closes [#181](https://github.com/ilijaNL/graphql-ws/issues/181) * **server:** Limit internal server error close message size ([8479f76](https://github.com/ilijaNL/graphql-ws/commit/8479f7676b6fd182d9ade6358dc926026ddab5b7)) * **server:** Log internal errors to the console ([6ddf0d1](https://github.com/ilijaNL/graphql-ws/commit/6ddf0d1ab394e7c7530fafe28d9e6260b1e1287b)) * **server:** Make sure to use `onSubscribe` result exclusively ([51fdb7c](https://github.com/ilijaNL/graphql-ws/commit/51fdb7c75487c399267f04a4ea2146f2e964d4cf)) * **server:** No need to bind `this` scope ([f76ac73](https://github.com/ilijaNL/graphql-ws/commit/f76ac73e9d21c80abe0118007e168e4f5d525036)) * **server:** Operation result can be async generator or iterable ([b1fb883](https://github.com/ilijaNL/graphql-ws/commit/b1fb88304a8c5e560620154524ed2218be2e4c99)) * **server:** Receiving more than one `ConnectionInit` message closes the socket immediately ([757c6e9](https://github.com/ilijaNL/graphql-ws/commit/757c6e966ffa1756cca2687b0275d7d7eff2ce87)) * **server:** Respect completed subscriptions even if `subscribe` or `onOperation` didnt resolve yet ([4700154](https://github.com/ilijaNL/graphql-ws/commit/4700154566deb6b7d58a15a78ca57f830af40fe6)) * **server:** Return ping's payload through the response pong ([47730a9](https://github.com/ilijaNL/graphql-ws/commit/47730a9cc735b8e309656a3fb8b9e5b0e05a304a)), closes [#117](https://github.com/ilijaNL/graphql-ws/issues/117) * **server:** scoped execution result formatter from `onConnect` ([f91fadb](https://github.com/ilijaNL/graphql-ws/commit/f91fadb6464a6e74f9a11555026dd5f9279df563)) * **server:** Should clean up subscription reservations on abrupt errors without relying on connection close ([611c223](https://github.com/ilijaNL/graphql-ws/commit/611c223471ed3aeee55a80e12d4cdc1a86176b15)) * **server:** Shouldn't send a complete message if client sent it ([331fe47](https://github.com/ilijaNL/graphql-ws/commit/331fe4749227393297da4d97a4370ab6f76cc73a)), closes [#403](https://github.com/ilijaNL/graphql-ws/issues/403) * **server:** store the intial request in the context ([6927ee0](https://github.com/ilijaNL/graphql-ws/commit/6927ee01c0b8224f8290322a964e70382614d0e8)) * **server:** Use `subscribe` from the config ([6fbd47c](https://github.com/ilijaNL/graphql-ws/commit/6fbd47c2ef14a6ae4297ffe0aaa689eeb3741ed0)) * **server:** use subscription specific formatter for queries and mutations too ([5672a04](https://github.com/ilijaNL/graphql-ws/commit/5672a045332ea835e6ff7ce862c7c2a46729363b)) * Sink's next callback always receives an `ExecutionResult` ([045b402](https://github.com/ilijaNL/graphql-ws/commit/045b402987b749790424ca1b89c2d5aa93d8565a)) * Stop sending messages after receiving complete ([#65](https://github.com/ilijaNL/graphql-ws/issues/65)) ([3f4f836](https://github.com/ilijaNL/graphql-ws/commit/3f4f836c395139617a268082131084c4f992ba5f)) * Support more `graphql` versions ([de69b4e](https://github.com/ilijaNL/graphql-ws/commit/de69b4ea39905f9b3343711e9defe68c6746b842)) * Support more Node versions by not using `globalThis` ([79c2ed2](https://github.com/ilijaNL/graphql-ws/commit/79c2ed2056b69bd9b56984947d78897e36594b80)) * Use `4406` close code for unsupported subprotocol (`1002` is an internal WebSocket close code) ([df85281](https://github.com/ilijaNL/graphql-ws/commit/df85281eceab1b6b53747efc83db90602051b8f8)) * Use `4500` close code for internal server errors (`1011` is an internal WebSocket close code) ([3c0316d](https://github.com/ilijaNL/graphql-ws/commit/3c0316df3b785900b67aaf85435f5fb23ff673c3)) * Use `ID` type for message id field ([87ebd35](https://github.com/ilijaNL/graphql-ws/commit/87ebd357da73ec83d72583f1c82fc14dfe2ffe5a)) * **uWebSockets:** Handle premature and abrupt socket closes ([9d3ff52](https://github.com/ilijaNL/graphql-ws/commit/9d3ff52e05420847eda9d0cf8d4730cafb9bcd36)), closes [#186](https://github.com/ilijaNL/graphql-ws/issues/186) * Warn about subscriptions-transport-ws clients and provide migration link ([e080739](https://github.com/ilijaNL/graphql-ws/commit/e08073956621b52d858b617eff5cf993ccedea16)), closes [#339](https://github.com/ilijaNL/graphql-ws/issues/339) [#325](https://github.com/ilijaNL/graphql-ws/issues/325) * **ws,fastify-websocket:** Send only on ready socket ([8d13c9e](https://github.com/ilijaNL/graphql-ws/commit/8d13c9ee7bc96ac819d44fdd2b2ffe61b4690684)) * **ws,uWebSockets,@fastify/websocket:** Handle internal errors that are not instances of `Error` ([#442](https://github.com/ilijaNL/graphql-ws/issues/442)) ([9884889](https://github.com/ilijaNL/graphql-ws/commit/9884889540d47a29891bd5c2ceb220cfbfd184af)), closes [#441](https://github.com/ilijaNL/graphql-ws/issues/441) * **ws:** Handle socket emitted errors ([a22c00f](https://github.com/ilijaNL/graphql-ws/commit/a22c00ff406f19ca706afdf6fdd7de98571bce78)) * **ws:** Limit server emitted error close message size ([50620df](https://github.com/ilijaNL/graphql-ws/commit/50620dfbe2320cf35724ffc79fda80c836042f25)) * **ws:** Log server emitted errors to the console ([0826b0a](https://github.com/ilijaNL/graphql-ws/commit/0826b0a994ca79b4589b5feed53d5bc98c88714f)) * yarn engine is not required ([#34](https://github.com/ilijaNL/graphql-ws/issues/34)) ([89484b8](https://github.com/ilijaNL/graphql-ws/commit/89484b89d6f561d0eb43d64e8c1ee568bcfebcd6)) ### Features * `cjs`, `esm` and `umd` builds with minification and compression for the browser ([#58](https://github.com/ilijaNL/graphql-ws/issues/58)) ([ebb8dfe](https://github.com/ilijaNL/graphql-ws/commit/ebb8dfe8a1e50507bcc2b0929600d755ddd98b1d)) * Add `extensions` field to the subscribe message payload ([d86a8e4](https://github.com/ilijaNL/graphql-ws/commit/d86a8e472a32aa4a12f6794f90ca2419f9f87fdb)) * Allow null payloads in messages ([#456](https://github.com/ilijaNL/graphql-ws/issues/456)) ([eeb0265](https://github.com/ilijaNL/graphql-ws/commit/eeb02656505e0d56aafc1eb7c39efcdc41748873)), closes [#455](https://github.com/ilijaNL/graphql-ws/issues/455) * Bidirectional ping/pong message types ([#201](https://github.com/ilijaNL/graphql-ws/issues/201)) ([1efaf83](https://github.com/ilijaNL/graphql-ws/commit/1efaf8347dd199687393e8074ab70362727591f2)) * Centralise expected close codes in `CloseCode` enum ([d10a75c](https://github.com/ilijaNL/graphql-ws/commit/d10a75c3a9fde41ad7944aeff40ffe4df9946bcd)) * **client:** `connectionParams` can return `undefined` ([a543187](https://github.com/ilijaNL/graphql-ws/commit/a543187614dfb90cbc1959c5f2b9669add3823bb)) * **client:** `connectionParams` may return a promise ([#71](https://github.com/ilijaNL/graphql-ws/issues/71)) ([33f210c](https://github.com/ilijaNL/graphql-ws/commit/33f210ce3796f3b961fa5ca03af938cfd899c9b9)) * **client:** `disablePong` option for when implementing a custom pinger ([6510360](https://github.com/ilijaNL/graphql-ws/commit/651036002c3c26dca8495def7ac271e021fcb420)), closes [#117](https://github.com/ilijaNL/graphql-ws/issues/117) * **client:** `isFatalConnectionProblem` option for deciding if the connect error should be immediately reported or the connection retried ([#126](https://github.com/ilijaNL/graphql-ws/issues/126)) ([8115871](https://github.com/ilijaNL/graphql-ws/commit/81158711f9dba05588c656ed32c07331c9a5786d)), closes [#122](https://github.com/ilijaNL/graphql-ws/issues/122) * **client:** `onNonLazyError` allows you to catch errors reported in non-lazy mode ([cd1e7df](https://github.com/ilijaNL/graphql-ws/commit/cd1e7df70ab63b59bbfac1354b8779173fb1f333)) * **client:** `url` option accepts a function or a Promise ([#143](https://github.com/ilijaNL/graphql-ws/issues/143)) ([76f522f](https://github.com/ilijaNL/graphql-ws/commit/76f522fc60e130f83032a1a0a61b741eb5b2f76f)), closes [#145](https://github.com/ilijaNL/graphql-ws/issues/145) [#146](https://github.com/ilijaNL/graphql-ws/issues/146) * **client:** Add `connectionAckWaitTimeout` option ([#228](https://github.com/ilijaNL/graphql-ws/issues/228)) ([35ce054](https://github.com/ilijaNL/graphql-ws/commit/35ce05460767a60d8763e6123a6da051ba970029)) * **client:** Add `opened` event for when a WebSocket opens ([9053224](https://github.com/ilijaNL/graphql-ws/commit/9053224863ac3ca07dbe990f1332e3f7f79da01d)) * **client:** Allow keeping the connection alive for some time before lazy closing ([#69](https://github.com/ilijaNL/graphql-ws/issues/69)) ([555c2c3](https://github.com/ilijaNL/graphql-ws/commit/555c2c35b84a864ac5732976e704eed9fcacd08c)) * **client:** Deprecate `isFatalConnectionProblem` option in favour of `shouldRetry` ([d8dcf21](https://github.com/ilijaNL/graphql-ws/commit/d8dcf219ecb55241d4a99d500eae69de564651f4)) * **client:** Emit events for `connecting`, `connected` and `closed` ([627775b](https://github.com/ilijaNL/graphql-ws/commit/627775b8e1aca8f359607020ff2c3bcc37b50787)) * **client:** Implement silent-reconnects ([c6f7872](https://github.com/ilijaNL/graphql-ws/commit/c6f7872126300befcc47e8e46e82342c2924f453)), closes [#7](https://github.com/ilijaNL/graphql-ws/issues/7) * **client:** introduce Socky 🧦 - the nifty internal socket state manager ([#8](https://github.com/ilijaNL/graphql-ws/issues/8)) ([a4bee6f](https://github.com/ilijaNL/graphql-ws/commit/a4bee6fb8c1bd56637363a76f6ab0c3b64f55931)) * **client:** Lazy option can be changed ([fb0ec14](https://github.com/ilijaNL/graphql-ws/commit/fb0ec1478e5219eb75e6bf2a1c2fd2a3a9cbb90d)) * **client:** Optional `generateID` to provide subscription IDs ([#22](https://github.com/ilijaNL/graphql-ws/issues/22)) ([9a3f54a](https://github.com/ilijaNL/graphql-ws/commit/9a3f54a8198379b402a8abe414ab5727ccec45cf)), closes [#21](https://github.com/ilijaNL/graphql-ws/issues/21) * **client:** Provide subscribe payload in `generateID` ([d0bc6e1](https://github.com/ilijaNL/graphql-ws/commit/d0bc6e15169285421fc7961c712d1d07c884a14e)), closes [#398](https://github.com/ilijaNL/graphql-ws/issues/398) * **client:** Re-implement following the new transport protocol ([#6](https://github.com/ilijaNL/graphql-ws/issues/6)) ([5191a35](https://github.com/ilijaNL/graphql-ws/commit/5191a358098c6f9a661ae90e0420fa430db9152c)) * **client:** Rename `keepAlive` option to `lazyCloseTimeout` ([3c1f13c](https://github.com/ilijaNL/graphql-ws/commit/3c1f13cd49ee00d7da80f3950eef8f414d909d58)) * **client:** Retry with randomised exponential backoff or provide your own strategy ([#84](https://github.com/ilijaNL/graphql-ws/issues/84)) ([d3e7a17](https://github.com/ilijaNL/graphql-ws/commit/d3e7a171603a3ef181c5af533768dcda416a1731)) * **client:** Support providing custom WebSocket implementations ([#18](https://github.com/ilijaNL/graphql-ws/issues/18)) ([1515fe2](https://github.com/ilijaNL/graphql-ws/commit/1515fe2adcc0bb2b18a1309550f4e41528985f54)) * **client:** Terminate the WebSocket abruptly and immediately ([53ad515](https://github.com/ilijaNL/graphql-ws/commit/53ad5156e85f358bfa1baa81f9787b6a8479527d)), closes [#290](https://github.com/ilijaNL/graphql-ws/issues/290) * Descriptive invalid message errors ([b46379e](https://github.com/ilijaNL/graphql-ws/commit/b46379e5946b8ce10e907588399350b8ba256c4c)), closes [#366](https://github.com/ilijaNL/graphql-ws/issues/366) * Optional `payload` for ping/pong message types ([2fe0345](https://github.com/ilijaNL/graphql-ws/commit/2fe03453e32112598af0faeecf054c899e658c1d)), closes [#117](https://github.com/ilijaNL/graphql-ws/issues/117) * Package ECMAScript Modules too ([#87](https://github.com/ilijaNL/graphql-ws/issues/87)) ([2108174](https://github.com/ilijaNL/graphql-ws/commit/2108174eb5e1f48656287a2e55adc67112a05314)) * Package rename `@enisdenjo/graphql-transport-ws` 👉 `graphql-transport-ws`. ([494f676](https://github.com/ilijaNL/graphql-ws/commit/494f6766279325769e81f52ce7b4b442c85f9476)) * Rewrite GraphQL over WebSocket Protocol ([#2](https://github.com/ilijaNL/graphql-ws/issues/2)) ([42045c5](https://github.com/ilijaNL/graphql-ws/commit/42045c577de9d95a81a37d850b38f4482914cebd)) * Send optional payload with the `ConnectionAck` message ([#60](https://github.com/ilijaNL/graphql-ws/issues/60)) ([1327e77](https://github.com/ilijaNL/graphql-ws/commit/1327e7735fc52f8318644b0f4cec86d3288a0e68)) * **server:** `context` may return a promise ([cd5c2f8](https://github.com/ilijaNL/graphql-ws/commit/cd5c2f8d0f9d11889052601c0fabdb8c6ed607fa)), closes [#74](https://github.com/ilijaNL/graphql-ws/issues/74) * **server:** `execute` and `subscribe` are optional ([#148](https://github.com/ilijaNL/graphql-ws/issues/148)) ([af748b0](https://github.com/ilijaNL/graphql-ws/commit/af748b0fd34da44950bd7fbbaeeebf743ff6973e)) * **server:** Add `onClose` callback for closures at _any_ point in time ([dd0d4fa](https://github.com/ilijaNL/graphql-ws/commit/dd0d4fa7828974b27876e138c0d09f78b2721d2d)) * **server:** Add `onDisconnect` callback ([#94](https://github.com/ilijaNL/graphql-ws/issues/94)) ([2a61268](https://github.com/ilijaNL/graphql-ws/commit/2a612687d2b3fe7dc9a62dca5a171a52c28b99ab)) * **server:** Add support for `ws@v8` ([9119153](https://github.com/ilijaNL/graphql-ws/commit/911915351ea58816db94c8eccfd4226462e2c8b7)) * **server:** Define execution/subscription `context` in creation options ([5b3d253](https://github.com/ilijaNL/graphql-ws/commit/5b3d25351cdd2714a1edb9833ab2c2c7a9316944)), closes [#13](https://github.com/ilijaNL/graphql-ws/issues/13) * **server:** Dynamic `schema` support by accepting a function or a Promise ([#147](https://github.com/ilijaNL/graphql-ws/issues/147)) ([6a0bf94](https://github.com/ilijaNL/graphql-ws/commit/6a0bf9473e6bc77afdaf81d16eeeeddcbe97276f)), closes [#127](https://github.com/ilijaNL/graphql-ws/issues/127) * **server:** For dynamic usage, `context` option can be a function too ([#46](https://github.com/ilijaNL/graphql-ws/issues/46)) ([149b582](https://github.com/ilijaNL/graphql-ws/commit/149b58266859d6f275c186581f71c3aff52cb4a3)) * **server:** Implement following the new transport protocol ([#1](https://github.com/ilijaNL/graphql-ws/issues/1)) ([a412d25](https://github.com/ilijaNL/graphql-ws/commit/a412d2570e484046a058c11f39813c7794ec9147)) * **server:** Log a warning for unsupported subprotocols ([88a12ef](https://github.com/ilijaNL/graphql-ws/commit/88a12ef3d9261e787a150d226210856688bf97da)), closes [#92](https://github.com/ilijaNL/graphql-ws/issues/92) * **server:** Make and use with your own flavour ([#64](https://github.com/ilijaNL/graphql-ws/issues/64)) ([38bde87](https://github.com/ilijaNL/graphql-ws/commit/38bde87122f4c39b0357c636fd98bfee886dd6e5)), closes [#61](https://github.com/ilijaNL/graphql-ws/issues/61) [#73](https://github.com/ilijaNL/graphql-ws/issues/73) [#75](https://github.com/ilijaNL/graphql-ws/issues/75) * **server:** More callbacks, clearer differences and higher extensibility ([#40](https://github.com/ilijaNL/graphql-ws/issues/40)) ([507a222](https://github.com/ilijaNL/graphql-ws/commit/507a2226719efacf6180705beb8bb9d88f80d7f3)) * **server:** Optional `onPing` and `onPong` message type listeners ([f36066f](https://github.com/ilijaNL/graphql-ws/commit/f36066f820ba2b2fabb728c77ca17b5ea5b8e6da)) * **server:** Pass roots for operation fields as an option ([dcb5ed4](https://github.com/ilijaNL/graphql-ws/commit/dcb5ed4dcc3c4569b104b2cbe9979161fad2ff0a)) * **server:** Support returning multiple results from `execute` ([#28](https://github.com/ilijaNL/graphql-ws/issues/28)) ([dbbd88b](https://github.com/ilijaNL/graphql-ws/commit/dbbd88bb26843da55d9558e7a44bff3108f095ab)) * **server:** Use `@fastify/websocket` ([#382](https://github.com/ilijaNL/graphql-ws/issues/382)) ([dd755b0](https://github.com/ilijaNL/graphql-ws/commit/dd755b0bb872b0daf79f53e484a16e868315a655)), closes [#381](https://github.com/ilijaNL/graphql-ws/issues/381) * **server:** Use `fastify-websocket` ([#200](https://github.com/ilijaNL/graphql-ws/issues/200)) ([b62fc95](https://github.com/ilijaNL/graphql-ws/commit/b62fc958bb0b67224d3c1b684d441bd8349c4b8a)) * **server:** Use `validate` option for custom GraphQL validation ([b68d56c](https://github.com/ilijaNL/graphql-ws/commit/b68d56ca1ffb8c7375d4292f716a63326d9d712f)) * **server:** Use uWebSockets ([#89](https://github.com/ilijaNL/graphql-ws/issues/89)) ([45d08fc](https://github.com/ilijaNL/graphql-ws/commit/45d08fcb9fde4159dea3f131f865f5d5bf5041d2)), closes [#61](https://github.com/ilijaNL/graphql-ws/issues/61) * Subscribe message `query` must be a string ([#45](https://github.com/ilijaNL/graphql-ws/issues/45)) ([60d9cd5](https://github.com/ilijaNL/graphql-ws/commit/60d9cd5509d1b989f3ca6a9370850ce0aae41522)) * Support custom JSON message `reviver` and `replacer` ([#172](https://github.com/ilijaNL/graphql-ws/issues/172)) ([0a9894e](https://github.com/ilijaNL/graphql-ws/commit/0a9894e21c42e70158ad65f045c8467c7177d4fa)) * TypeScript generic for connection init payload (`connectionParams`) ([#311](https://github.com/ilijaNL/graphql-ws/issues/311)) ([e67cf80](https://github.com/ilijaNL/graphql-ws/commit/e67cf807396ca45b1198ff4bb64e44b55778e1f8)) * **use:** Generic for extending the context extras ([401cd4c](https://github.com/ilijaNL/graphql-ws/commit/401cd4ce335e11dcf139502da3aa7dc1f23651c5)), closes [#189](https://github.com/ilijaNL/graphql-ws/issues/189) * **uWebSockets:** Add `persistedRequest` to context extra and deprecate uWS's stack allocated `request` ([#196](https://github.com/ilijaNL/graphql-ws/issues/196)) ([736e6ed](https://github.com/ilijaNL/graphql-ws/commit/736e6eda45d392292f315b9465b104dce4f2545f)) * **uWebSockets:** Drop deprecated `request` context extra ([02ea5ee](https://github.com/ilijaNL/graphql-ws/commit/02ea5ee8cfe918d547608c69482911e3d6091290)) * WebSocket Ping and Pong as keep-alive ([#11](https://github.com/ilijaNL/graphql-ws/issues/11)) ([16ae316](https://github.com/ilijaNL/graphql-ws/commit/16ae316b35a90d45f379336ec3ed5bedf3f2e28e)) ### Performance Improvements * **client:** Await timeouts only in recursive connects ([55c8fc8](https://github.com/ilijaNL/graphql-ws/commit/55c8fc8aba5dfb5ff3c66a11946f85ec631b1d41)) * **client:** Focus subscription message listeners on `id` ([#150](https://github.com/ilijaNL/graphql-ws/issues/150)) ([32c2268](https://github.com/ilijaNL/graphql-ws/commit/32c22686984e6f3c98388b31a08471c3e4ee96a6)) * **client:** Memoize message parsing for each subscriber ([2a7ba46](https://github.com/ilijaNL/graphql-ws/commit/2a7ba4642c0ea1a3294b8b3ea3440957ec7fcb7b)) * Easier message parser ([d44c6f1](https://github.com/ilijaNL/graphql-ws/commit/d44c6f18ccd2bc539bb541e6bfd1bf0c769c7856)) * Reduce runtime prototype traversal for hasOwnProperty ([#52](https://github.com/ilijaNL/graphql-ws/issues/52)) ([1bb9218](https://github.com/ilijaNL/graphql-ws/commit/1bb9218ad3ee9442442122c1d10910d51951b763)) ### Reverts * Revert "refactor: emit client connect in next tick during testing" ([c10d0bf](https://github.com/ilijaNL/graphql-ws/commit/c10d0bfa7303430dd57f9580b20353c2f32b0951)) ### BREAKING CHANGES * Because of the Protocol's strictness, an instant connection termination will happen whenever an invalid message is identified; meaning, all previous implementations will fail when receiving the new subprotocol ping/pong messages. **Beware,** the client will NOT ping the server by default. Please make sure to upgrade your stack in order to support the new ping/pong message types. A simple recipe showcasing a client that times out if no pong is received and measures latency, looks like this: ```js import { createClient } from 'graphql-ws'; let activeSocket, timedOut, pingSentAt = 0, latency = 0; createClient({ url: 'ws://i.time.out:4000/and-measure/latency', keepAlive: 10_000, // ping server every 10 seconds on: { connected: (socket) => (activeSocket = socket), ping: (received) => { if (!received /* sent */) { pingSentAt = Date.now(); timedOut = setTimeout(() => { if (activeSocket.readyState === WebSocket.OPEN) activeSocket.close(4408, 'Request Timeout'); }, 5_000); // wait 5 seconds for the pong and then close the connection } }, pong: (received) => { if (received) { latency = Date.now() - pingSentAt; clearTimeout(timedOut); // pong is received, clear connection close timeout } }, }, }); ``` * **uWebSockets:** The deprecated uWebSockets `request` context extra field has been dropped because it is stack allocated and cannot be used ouside the internal `upgrade` callback. * **client:** Client `keepAlive` option has been renamed to `lazyCloseTimeout` in order to eliminate ambiguity with the client to server pings keep-alive option. * **server:** The return function of `server.opened` (`closed`) now requires the close event code and reason for reporting to the `onDisconnect` callback. * **server:** The `Context.subscriptions` record value can be either an `AsyncIterator` or a `Promise`. * **client:** Client `retryTimeout` option has been replaced with the new `retryWait`. `retryWait` allows you to control the retry timeout strategy by resolving the returned promise when ready. The default implements the randomised exponential backoff like so: ```ts // this is the default const retryWait = async function randomisedExponentialBackoff(retries: number) { let retryDelay = 1000; // start with 1s delay for (let i = 0; i < retries; i++) { retryDelay *= 2; // square `retries` times } await new Promise((resolve) => setTimeout( // resolve pending promise with added random timeout from 300ms to 3s resolve, retryDelay + Math.floor(Math.random() * (3000 - 300) + 300), ), ); }; ``` * **server:** You now "make" a ready-to-use server that can be used with _any_ WebSocket implementation! Summary of breaking changes: - No more `keepAlive`. The user should provide its own keep-alive implementation. _(I highly recommend [WebSocket Ping and Pongs](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers#Pings_and_Pongs_The_Heartbeat_of_WebSockets))_ - No more HTTP `request` in the server context. - No more WebSocket in the server context (you're the one that creates it). - You use your own WebSocket server - Server exports only `makeServer` _(no more `createServer`)_ ### Benefits - You're responsible for the server (_any_ optimisation or adjustment can be applied) - Any WebSocket server can be used (or even mocked if necessary) - You control the disposal of the server (close or transfer clients however you wish) - New `extra` field in the `Context` for storing custom values useful for callbacks - Full control of authentication flow - Full control over error handling - True zero-dependency ### Migrating from v1 **Only the server has to be migrated.** Since this release allows you to use your favourite WebSocket library (or your own implementation), using [ws](https://github.com/websockets/ws) is just one way of using `graphql-ws`. This is how to use the implementation shipped with the lib: ```ts /** * ❌ instead of the lib creating a WebSocket server internally with the provided arguments */ import https from 'https'; import { createServer } from 'graphql-ws'; const server = https.createServer(...); createServer( { onConnect(ctx) { // were previously directly on the context ctx.request as IncomingRequest ctx.socket as WebSocket }, ...rest, }, { server, path: '/graphql', }, ); /** * ✅ you have to supply the server yourself */ import https from 'https'; import ws from 'ws'; // yarn add ws import { useServer } from 'graphql-ws/lib/use/ws'; // notice the import path const server = https.createServer(...); const wsServer = new ws.Server({ server, path: '/graphql', }); useServer( { onConnect(ctx) { // are now in the `extra` field ctx.extra.request as IncomingRequest ctx.extra.socket as WebSocket }, ...rest, }, wsServer, // optional keepAlive with ping pongs (defaults to 12 seconds) ); ``` * This lib is no longer compatible with [`subscriptions-transport-ws`](https://github.com/apollographql/subscriptions-transport-ws). It follows a redesigned transport protocol aiming to improve security, stability and reduce ambiguity. --- CHANGELOG.md | 322 +++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 323 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a5396d8..43a447c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,325 @@ +# 1.0.0 (2023-03-16) + + +### Bug Fixes + +* Add `browser` export map ([ea306db](https://github.com/ilijaNL/graphql-ws/commit/ea306db45a05ab712782b17c5a3a1ec60537eaa4)) +* Add `package.json` to exports map ([#119](https://github.com/ilijaNL/graphql-ws/issues/119)) ([1f09863](https://github.com/ilijaNL/graphql-ws/commit/1f09863de6b8731980dfc513708cd144a0d5bfbe)), closes [#118](https://github.com/ilijaNL/graphql-ws/issues/118) +* Add `uWebSockets` exports path ([36247cb](https://github.com/ilijaNL/graphql-ws/commit/36247cbce31b6d049a58622df58a9b5fb3dafbd6)), closes [#155](https://github.com/ilijaNL/graphql-ws/issues/155) +* Add support for `graphql@v16` ([ad5aea2](https://github.com/ilijaNL/graphql-ws/commit/ad5aea2703d8612a8f5b16814864268fd7f3feb6)) +* add the sink to the subscribed map AFTER emitting a subscribe message ([814f46c](https://github.com/ilijaNL/graphql-ws/commit/814f46c119792aaa240d0fcdb318dccdd1cc0e87)) +* Add types path to package.json `exports` ([#375](https://github.com/ilijaNL/graphql-ws/issues/375)) ([9f394d7](https://github.com/ilijaNL/graphql-ws/commit/9f394d7a8b70c1d6b2cfe6d30ba7e0777d578181)) +* **client:** `complete` should not be called after subscription `error` ([1fba419](https://github.com/ilijaNL/graphql-ws/commit/1fba4196306991eab1ca74d710adb66e894692a0)) +* **client:** `ConnectionInit` payload is absent if `connectionParams` returns nothing ([98f8265](https://github.com/ilijaNL/graphql-ws/commit/98f8265967aba43d206b3fffe2405f121d9c49b3)) +* **client:** `isFatalConnectionProblem` defaults to undefined for using `shouldRetry` ([9d5c573](https://github.com/ilijaNL/graphql-ws/commit/9d5c5733ba8bb181ef4f2051da958d80786c9ee6)) +* **client:** Accept nullish values for `operationName` and `variables` ([2d60dda](https://github.com/ilijaNL/graphql-ws/commit/2d60dda93c09b0c8d7b69241833174f991d7b450)) +* **client:** cant read the `CloseEvent.reason` after bundling so just pass the whole event to the sink error and let the user handle it ([9ccb46b](https://github.com/ilijaNL/graphql-ws/commit/9ccb46bc80024cb2de823702d2bd308052c6c516)) +* **client:** Close event's `wasClean` is not necessary ([2c65f0e](https://github.com/ilijaNL/graphql-ws/commit/2c65f0ee91a6372a9c2935183d9be0be50f40663)), closes [#81](https://github.com/ilijaNL/graphql-ws/issues/81) +* **client:** Close with error message during connecting issues ([f8ecdd7](https://github.com/ilijaNL/graphql-ws/commit/f8ecdd78e200a6a752ec1e72fb14d83e6103dd02)) +* **client:** Connection locks dont increment on retries ([1e7bd97](https://github.com/ilijaNL/graphql-ws/commit/1e7bd97d47525040dd88803039b17f77db1c6c2a)), closes [#153](https://github.com/ilijaNL/graphql-ws/issues/153) +* **client:** Debounce close by `lazyCloseTimeout` ([c332837](https://github.com/ilijaNL/graphql-ws/commit/c332837c50da09174a9741a1903a5471f8a1c42d)), closes [#388](https://github.com/ilijaNL/graphql-ws/issues/388) +* **client:** Dispose of subscription on complete or error messages ([#23](https://github.com/ilijaNL/graphql-ws/issues/23)) ([fb4d8e9](https://github.com/ilijaNL/graphql-ws/commit/fb4d8e9efdfdd0cbe3b7cc34ddadbad3a795ae35)) +* **client:** Distinguish client connection closes ([ed4d9db](https://github.com/ilijaNL/graphql-ws/commit/ed4d9db0fdf722a98ed8e95d9f5af6ae952acd20)) +* **client:** Don't complete after connection error ([5f829c3](https://github.com/ilijaNL/graphql-ws/commit/5f829c36a73e6e8566247d62e2ea395e6d18d8eb)) +* **client:** Export relevant elements from the browser bundle ([b106dbe](https://github.com/ilijaNL/graphql-ws/commit/b106dbed1440488692a5588dcfd73f2f5a855a74)), closes [#97](https://github.com/ilijaNL/graphql-ws/issues/97) +* **client:** Lazy connects after successful reconnects are not retries ([99b85a3](https://github.com/ilijaNL/graphql-ws/commit/99b85a3bebfdc4fada03e6c71c2703807ac6d3cd)) +* **client:** Limit client emitted error close message size ([2d959f6](https://github.com/ilijaNL/graphql-ws/commit/2d959f61c9cf0119cd4b20f843dd82fe584141a6)) +* **client:** New `error` event listener for handling connection errors ([#136](https://github.com/ilijaNL/graphql-ws/issues/136)) ([127b69f](https://github.com/ilijaNL/graphql-ws/commit/127b69fa5df8765a4a17a928191baa6c85985409)), closes [#135](https://github.com/ilijaNL/graphql-ws/issues/135) +* **client:** No retries when disposed ([0d5e6c2](https://github.com/ilijaNL/graphql-ws/commit/0d5e6c259eee5e331c5cef92246888745edda5a4)) +* **client:** One cleanup per subscription ([#67](https://github.com/ilijaNL/graphql-ws/issues/67)) ([5a5ae4d](https://github.com/ilijaNL/graphql-ws/commit/5a5ae4d01afd0c9aa51090342d7f699daf4fbafc)) +* **client:** Only `query` is required in the subscribe payload ([e892530](https://github.com/ilijaNL/graphql-ws/commit/e892530b37108a210976e416b2f5eb3004be7ad3)) +* **client:** Reduce WebSocket event listeners and add new client `message` event ([#104](https://github.com/ilijaNL/graphql-ws/issues/104)) ([68d0e20](https://github.com/ilijaNL/graphql-ws/commit/68d0e20674488e8792a61d07f068233d78acaa3a)), closes [#102](https://github.com/ilijaNL/graphql-ws/issues/102) +* **client:** Report close causing internal errors to error listeners ([4e7e389](https://github.com/ilijaNL/graphql-ws/commit/4e7e3896e62c934ac9301518fb410d23ae9a8bb8)) +* **client:** Report close error even if `Complete` message followed ([27754b2](https://github.com/ilijaNL/graphql-ws/commit/27754b213fe4be3f7a918a0881700cf91825048e)), closes [#245](https://github.com/ilijaNL/graphql-ws/issues/245) +* **client:** Return ping's payload through the response pong ([ee6193a](https://github.com/ilijaNL/graphql-ws/commit/ee6193a6b789124f903b4688df8a6c680bbadc81)) +* **client:** send complete message and close only if socket is still open ([49b75ce](https://github.com/ilijaNL/graphql-ws/commit/49b75cec60fec9c8a42119b124a9c54d29d30308)) +* **client:** Should emit `closed` event when disposing ([5800de8](https://github.com/ilijaNL/graphql-ws/commit/5800de8d343649bb4c93ca31c61911879123c736)), closes [#108](https://github.com/ilijaNL/graphql-ws/issues/108) +* **client:** Shouldn't reconnect if all subscriptions complete while waiting for retry ([2826c10](https://github.com/ilijaNL/graphql-ws/commit/2826c103a2f5786575157c6aa9cbd270746b57ca)), closes [#163](https://github.com/ilijaNL/graphql-ws/issues/163) +* **client:** Shouldn’t send the `Complete` message if socket is not open ([cd12024](https://github.com/ilijaNL/graphql-ws/commit/cd12024c19bdcf859c5a9a6b7a072ea252401524)) +* **client:** Some close events are not worth retrying ([4d9134b](https://github.com/ilijaNL/graphql-ws/commit/4d9134b8704446f0b2674c71e25d7c6c44000c9a)) +* **client:** Specify and fail on fatal internal WebSocket close codes ([a720125](https://github.com/ilijaNL/graphql-ws/commit/a7201251ee4d090e2bd3e55e8e50dbc1501231a0)) +* **client:** Stabilize and simplify internals ([#100](https://github.com/ilijaNL/graphql-ws/issues/100)) ([5ff8f1d](https://github.com/ilijaNL/graphql-ws/commit/5ff8f1dfb34d1a063fdfff8893c789c8b2c60d6e)), closes [#99](https://github.com/ilijaNL/graphql-ws/issues/99) [#85](https://github.com/ilijaNL/graphql-ws/issues/85) +* **client:** Stop execution if `connectionParams` took too long and the server kicked the client off ([1e94e45](https://github.com/ilijaNL/graphql-ws/commit/1e94e45d51b13bd870273a63e33819055209f607)), closes [#331](https://github.com/ilijaNL/graphql-ws/issues/331) +* **client:** Subscribes even if socket is in CLOSING state due to all subscriptions being completed ([3e3b8b7](https://github.com/ilijaNL/graphql-ws/commit/3e3b8b771d571f9beaee72d22481aac976af663e)), closes [#173](https://github.com/ilijaNL/graphql-ws/issues/173) [#170](https://github.com/ilijaNL/graphql-ws/issues/170) +* **client:** Subscription can be disposed only once ([abd9c28](https://github.com/ilijaNL/graphql-ws/commit/abd9c28a9d2c43de9babb3488d7cb9eb7f3d3e15)), closes [#170](https://github.com/ilijaNL/graphql-ws/issues/170) +* **client:** Subscriptions acquire locks ([eb6cb2a](https://github.com/ilijaNL/graphql-ws/commit/eb6cb2a0654489e1210a8db93f90bfc3ebfe94e4)) +* **client:** Time retries and socket change waits ([7c707db](https://github.com/ilijaNL/graphql-ws/commit/7c707db3c8c3b1991a7e1b95a225efd8d58d5615)), closes [#85](https://github.com/ilijaNL/graphql-ws/issues/85) +* **client:** Wait for server acknowledgement indefinitely ([a4bd602](https://github.com/ilijaNL/graphql-ws/commit/a4bd6029916e26a48b3f1acbbf9d741775e34baa)), closes [#98](https://github.com/ilijaNL/graphql-ws/issues/98) +* Close the details tag in the README ([84144c4](https://github.com/ilijaNL/graphql-ws/commit/84144c4c958674c4549cc48e84563bcb9f7c5e9d)) +* correctly detect WebSocket server ([eab29dc](https://github.com/ilijaNL/graphql-ws/commit/eab29dcae3d031a117de37dee09770833e9573cf)) +* Define entry points through the `exports` field and use `.mjs` suffixed ESM imports ([#110](https://github.com/ilijaNL/graphql-ws/issues/110)) ([4196238](https://github.com/ilijaNL/graphql-ws/commit/4196238888bffe4fb958bc665512b79eb384a28e)) +* Define graphql execution results ([a64c91b](https://github.com/ilijaNL/graphql-ws/commit/a64c91bbfab8433e8fec2a32a64ee4d402f182c6)) +* Drop TypeScript DOM lib dependency ([a81e8c1](https://github.com/ilijaNL/graphql-ws/commit/a81e8c1ea080984ddd6d5e58c154b866ee44c14c)) +* export both the client and the server from index ([29923b1](https://github.com/ilijaNL/graphql-ws/commit/29923b1e35a462c5b5a19d64603d59f25c1c5987)) +* Export useful types ([e4cc4d4](https://github.com/ilijaNL/graphql-ws/commit/e4cc4d4df8efb77aed14053a32af3464dc2a95db)) +* **fastify-websocket:** Handle connection and socket emitted errors ([71e9586](https://github.com/ilijaNL/graphql-ws/commit/71e9586247e91a307b1b401667c8e9f2bb42d932)) +* **fastify-websocket:** Handle server emitted errors ([3fa17a7](https://github.com/ilijaNL/graphql-ws/commit/3fa17a704689da41d66a1934d1aa09a305e01d9f)) +* http and ws have no default exports ([5c01ed9](https://github.com/ilijaNL/graphql-ws/commit/5c01ed924793ce17f036d26d9d5d63cd5cecc6aa)) +* include `types` file holding important types ([f3e4edf](https://github.com/ilijaNL/graphql-ws/commit/f3e4edf96e5c6cecf025811e2beb7ecc324ea962)) +* Main entrypoint in `exports` is just `"."` ([8f70b02](https://github.com/ilijaNL/graphql-ws/commit/8f70b02ec1ed1b88fd80e7e04eecf4552b382bbc)) +* **message:** Allow `data` field to be of any type ([533248e](https://github.com/ilijaNL/graphql-ws/commit/533248e0bcfd857c7960c9e8671cbd300788ad7d)), closes [#72](https://github.com/ilijaNL/graphql-ws/issues/72) +* **message:** Allow `payload` field to be of any type for `NextMessage` ([7cebbfe](https://github.com/ilijaNL/graphql-ws/commit/7cebbfe00dc3c360e80e8962f345a28743b49c1f)), closes [#72](https://github.com/ilijaNL/graphql-ws/issues/72) +* Node 10 is the min supported version ([19844d7](https://github.com/ilijaNL/graphql-ws/commit/19844d72f4638f9f7126870f9d9a744cdb4814c4)) +* notify only relevant sinks about errors or completions ([62155ba](https://github.com/ilijaNL/graphql-ws/commit/62155ba0b79516141633b86765921b2401fcc2ed)) +* Only UMD build has side effects ([66ed43f](https://github.com/ilijaNL/graphql-ws/commit/66ed43fe60b57fa268490aec07c3254b06ab3473)) +* Reorder types paths in package.json for better import resolution ([#406](https://github.com/ilijaNL/graphql-ws/issues/406)) ([37263c5](https://github.com/ilijaNL/graphql-ws/commit/37263c51f4c6e92e4955df5058b76f452b2d0399)) +* reset connected/connecting state when disconnecting and disposing ([2eb3cd5](https://github.com/ilijaNL/graphql-ws/commit/2eb3cd5965cf34f6d6b21748daea520163b9c789)) +* **server:** `handleProtocols` accepts arrays too and gracefully rejects other types ([98dec1a](https://github.com/ilijaNL/graphql-ws/commit/98dec1addb59c2a215cb4425a4927c5f33a78b4c)), closes [#318](https://github.com/ilijaNL/graphql-ws/issues/318) +* **server:** `onDisconnect` is called exclusively if the connection is acknowledged ([33ed5f2](https://github.com/ilijaNL/graphql-ws/commit/33ed5f227a787773a6661d4e5efce1be5e500525)) +* **server:** `return` instead of `break` at switch case ends ([e9447e4](https://github.com/ilijaNL/graphql-ws/commit/e9447e45cfa572982e7fe0ffa32a113feac06b94)), closes [#140](https://github.com/ilijaNL/graphql-ws/issues/140) +* **server:** `subscription` operations are distinct on the message ID ([#24](https://github.com/ilijaNL/graphql-ws/issues/24)) ([dfffb05](https://github.com/ilijaNL/graphql-ws/commit/dfffb0502be5dd9ab5598e785b9988b1f4000227)) +* **server:** allow skipping init message wait with zero values ([a7419df](https://github.com/ilijaNL/graphql-ws/commit/a7419df077acb018418016c7a06716fb3c054ddb)) +* **server:** Async iterator must implement `return` ([d99982b](https://github.com/ilijaNL/graphql-ws/commit/d99982b1fc887d913cb1b3a031b1c5c3706b4a35)), closes [#149](https://github.com/ilijaNL/graphql-ws/issues/149) +* **server:** Client can complete/cancel any operation ([0ad1c4c](https://github.com/ilijaNL/graphql-ws/commit/0ad1c4c174d13effc185de49b42c64cdfd54a7ec)) +* **server:** Close socket if `onSubscribe` returns invalid array ([#53](https://github.com/ilijaNL/graphql-ws/issues/53)) ([0464a54](https://github.com/ilijaNL/graphql-ws/commit/0464a54eee09dfdf66d65bf539a4d8f596be2697)) +* **server:** Consistently set `rootValue` and `contextValue`, if not overridden ([#49](https://github.com/ilijaNL/graphql-ws/issues/49)) ([7aa3bcd](https://github.com/ilijaNL/graphql-ws/commit/7aa3bcdd38d40e83306f867a5b6b1bd612ec5fe3)) +* **server:** Distribute server error to all clients even if one error listener throws ([#56](https://github.com/ilijaNL/graphql-ws/issues/56)) ([b96dbb9](https://github.com/ilijaNL/graphql-ws/commit/b96dbb98bb6f71956321ce1202af0af50df4e40e)) +* **server:** Don't surface bad request error details in production ([#55](https://github.com/ilijaNL/graphql-ws/issues/55)) ([70317b2](https://github.com/ilijaNL/graphql-ws/commit/70317b2619b7729e5d5556b4e5388f142414b082)) +* **server:** Enforce ID uniqueness across all operations and during the whole subscription life ([#96](https://github.com/ilijaNL/graphql-ws/issues/96)) ([65d1bfa](https://github.com/ilijaNL/graphql-ws/commit/65d1bfa876fa5ff724c736b7ce958a1b1c9b0dc3)) +* **server:** Handle upgrade requests with multiple subprotocols and omit `Sec-WebSocket-Protocol` header if none supported ([9bae064](https://github.com/ilijaNL/graphql-ws/commit/9bae06437d6dc37c6dbafa18f905e27659a12da2)) +* **server:** Hide internal server error messages from the client in production ([36fe405](https://github.com/ilijaNL/graphql-ws/commit/36fe405e0e7d5942f858073797cc85bb41739a1d)), closes [#31](https://github.com/ilijaNL/graphql-ws/issues/31) +* **server:** Init context first on connection open ([a80e753](https://github.com/ilijaNL/graphql-ws/commit/a80e7534cc0570fa111e15f196ba53fdb5ced667)), closes [#181](https://github.com/ilijaNL/graphql-ws/issues/181) +* **server:** Limit internal server error close message size ([8479f76](https://github.com/ilijaNL/graphql-ws/commit/8479f7676b6fd182d9ade6358dc926026ddab5b7)) +* **server:** Log internal errors to the console ([6ddf0d1](https://github.com/ilijaNL/graphql-ws/commit/6ddf0d1ab394e7c7530fafe28d9e6260b1e1287b)) +* **server:** Make sure to use `onSubscribe` result exclusively ([51fdb7c](https://github.com/ilijaNL/graphql-ws/commit/51fdb7c75487c399267f04a4ea2146f2e964d4cf)) +* **server:** No need to bind `this` scope ([f76ac73](https://github.com/ilijaNL/graphql-ws/commit/f76ac73e9d21c80abe0118007e168e4f5d525036)) +* **server:** Operation result can be async generator or iterable ([b1fb883](https://github.com/ilijaNL/graphql-ws/commit/b1fb88304a8c5e560620154524ed2218be2e4c99)) +* **server:** Receiving more than one `ConnectionInit` message closes the socket immediately ([757c6e9](https://github.com/ilijaNL/graphql-ws/commit/757c6e966ffa1756cca2687b0275d7d7eff2ce87)) +* **server:** Respect completed subscriptions even if `subscribe` or `onOperation` didnt resolve yet ([4700154](https://github.com/ilijaNL/graphql-ws/commit/4700154566deb6b7d58a15a78ca57f830af40fe6)) +* **server:** Return ping's payload through the response pong ([47730a9](https://github.com/ilijaNL/graphql-ws/commit/47730a9cc735b8e309656a3fb8b9e5b0e05a304a)), closes [#117](https://github.com/ilijaNL/graphql-ws/issues/117) +* **server:** scoped execution result formatter from `onConnect` ([f91fadb](https://github.com/ilijaNL/graphql-ws/commit/f91fadb6464a6e74f9a11555026dd5f9279df563)) +* **server:** Should clean up subscription reservations on abrupt errors without relying on connection close ([611c223](https://github.com/ilijaNL/graphql-ws/commit/611c223471ed3aeee55a80e12d4cdc1a86176b15)) +* **server:** Shouldn't send a complete message if client sent it ([331fe47](https://github.com/ilijaNL/graphql-ws/commit/331fe4749227393297da4d97a4370ab6f76cc73a)), closes [#403](https://github.com/ilijaNL/graphql-ws/issues/403) +* **server:** store the intial request in the context ([6927ee0](https://github.com/ilijaNL/graphql-ws/commit/6927ee01c0b8224f8290322a964e70382614d0e8)) +* **server:** Use `subscribe` from the config ([6fbd47c](https://github.com/ilijaNL/graphql-ws/commit/6fbd47c2ef14a6ae4297ffe0aaa689eeb3741ed0)) +* **server:** use subscription specific formatter for queries and mutations too ([5672a04](https://github.com/ilijaNL/graphql-ws/commit/5672a045332ea835e6ff7ce862c7c2a46729363b)) +* Sink's next callback always receives an `ExecutionResult` ([045b402](https://github.com/ilijaNL/graphql-ws/commit/045b402987b749790424ca1b89c2d5aa93d8565a)) +* Stop sending messages after receiving complete ([#65](https://github.com/ilijaNL/graphql-ws/issues/65)) ([3f4f836](https://github.com/ilijaNL/graphql-ws/commit/3f4f836c395139617a268082131084c4f992ba5f)) +* Support more `graphql` versions ([de69b4e](https://github.com/ilijaNL/graphql-ws/commit/de69b4ea39905f9b3343711e9defe68c6746b842)) +* Support more Node versions by not using `globalThis` ([79c2ed2](https://github.com/ilijaNL/graphql-ws/commit/79c2ed2056b69bd9b56984947d78897e36594b80)) +* Use `4406` close code for unsupported subprotocol (`1002` is an internal WebSocket close code) ([df85281](https://github.com/ilijaNL/graphql-ws/commit/df85281eceab1b6b53747efc83db90602051b8f8)) +* Use `4500` close code for internal server errors (`1011` is an internal WebSocket close code) ([3c0316d](https://github.com/ilijaNL/graphql-ws/commit/3c0316df3b785900b67aaf85435f5fb23ff673c3)) +* Use `ID` type for message id field ([87ebd35](https://github.com/ilijaNL/graphql-ws/commit/87ebd357da73ec83d72583f1c82fc14dfe2ffe5a)) +* **uWebSockets:** Handle premature and abrupt socket closes ([9d3ff52](https://github.com/ilijaNL/graphql-ws/commit/9d3ff52e05420847eda9d0cf8d4730cafb9bcd36)), closes [#186](https://github.com/ilijaNL/graphql-ws/issues/186) +* Warn about subscriptions-transport-ws clients and provide migration link ([e080739](https://github.com/ilijaNL/graphql-ws/commit/e08073956621b52d858b617eff5cf993ccedea16)), closes [#339](https://github.com/ilijaNL/graphql-ws/issues/339) [#325](https://github.com/ilijaNL/graphql-ws/issues/325) +* **ws,fastify-websocket:** Send only on ready socket ([8d13c9e](https://github.com/ilijaNL/graphql-ws/commit/8d13c9ee7bc96ac819d44fdd2b2ffe61b4690684)) +* **ws,uWebSockets,@fastify/websocket:** Handle internal errors that are not instances of `Error` ([#442](https://github.com/ilijaNL/graphql-ws/issues/442)) ([9884889](https://github.com/ilijaNL/graphql-ws/commit/9884889540d47a29891bd5c2ceb220cfbfd184af)), closes [#441](https://github.com/ilijaNL/graphql-ws/issues/441) +* **ws:** Handle socket emitted errors ([a22c00f](https://github.com/ilijaNL/graphql-ws/commit/a22c00ff406f19ca706afdf6fdd7de98571bce78)) +* **ws:** Limit server emitted error close message size ([50620df](https://github.com/ilijaNL/graphql-ws/commit/50620dfbe2320cf35724ffc79fda80c836042f25)) +* **ws:** Log server emitted errors to the console ([0826b0a](https://github.com/ilijaNL/graphql-ws/commit/0826b0a994ca79b4589b5feed53d5bc98c88714f)) +* yarn engine is not required ([#34](https://github.com/ilijaNL/graphql-ws/issues/34)) ([89484b8](https://github.com/ilijaNL/graphql-ws/commit/89484b89d6f561d0eb43d64e8c1ee568bcfebcd6)) + + +### Features + +* `cjs`, `esm` and `umd` builds with minification and compression for the browser ([#58](https://github.com/ilijaNL/graphql-ws/issues/58)) ([ebb8dfe](https://github.com/ilijaNL/graphql-ws/commit/ebb8dfe8a1e50507bcc2b0929600d755ddd98b1d)) +* Add `extensions` field to the subscribe message payload ([d86a8e4](https://github.com/ilijaNL/graphql-ws/commit/d86a8e472a32aa4a12f6794f90ca2419f9f87fdb)) +* Allow null payloads in messages ([#456](https://github.com/ilijaNL/graphql-ws/issues/456)) ([eeb0265](https://github.com/ilijaNL/graphql-ws/commit/eeb02656505e0d56aafc1eb7c39efcdc41748873)), closes [#455](https://github.com/ilijaNL/graphql-ws/issues/455) +* Bidirectional ping/pong message types ([#201](https://github.com/ilijaNL/graphql-ws/issues/201)) ([1efaf83](https://github.com/ilijaNL/graphql-ws/commit/1efaf8347dd199687393e8074ab70362727591f2)) +* Centralise expected close codes in `CloseCode` enum ([d10a75c](https://github.com/ilijaNL/graphql-ws/commit/d10a75c3a9fde41ad7944aeff40ffe4df9946bcd)) +* **client:** `connectionParams` can return `undefined` ([a543187](https://github.com/ilijaNL/graphql-ws/commit/a543187614dfb90cbc1959c5f2b9669add3823bb)) +* **client:** `connectionParams` may return a promise ([#71](https://github.com/ilijaNL/graphql-ws/issues/71)) ([33f210c](https://github.com/ilijaNL/graphql-ws/commit/33f210ce3796f3b961fa5ca03af938cfd899c9b9)) +* **client:** `disablePong` option for when implementing a custom pinger ([6510360](https://github.com/ilijaNL/graphql-ws/commit/651036002c3c26dca8495def7ac271e021fcb420)), closes [#117](https://github.com/ilijaNL/graphql-ws/issues/117) +* **client:** `isFatalConnectionProblem` option for deciding if the connect error should be immediately reported or the connection retried ([#126](https://github.com/ilijaNL/graphql-ws/issues/126)) ([8115871](https://github.com/ilijaNL/graphql-ws/commit/81158711f9dba05588c656ed32c07331c9a5786d)), closes [#122](https://github.com/ilijaNL/graphql-ws/issues/122) +* **client:** `onNonLazyError` allows you to catch errors reported in non-lazy mode ([cd1e7df](https://github.com/ilijaNL/graphql-ws/commit/cd1e7df70ab63b59bbfac1354b8779173fb1f333)) +* **client:** `url` option accepts a function or a Promise ([#143](https://github.com/ilijaNL/graphql-ws/issues/143)) ([76f522f](https://github.com/ilijaNL/graphql-ws/commit/76f522fc60e130f83032a1a0a61b741eb5b2f76f)), closes [#145](https://github.com/ilijaNL/graphql-ws/issues/145) [#146](https://github.com/ilijaNL/graphql-ws/issues/146) +* **client:** Add `connectionAckWaitTimeout` option ([#228](https://github.com/ilijaNL/graphql-ws/issues/228)) ([35ce054](https://github.com/ilijaNL/graphql-ws/commit/35ce05460767a60d8763e6123a6da051ba970029)) +* **client:** Add `opened` event for when a WebSocket opens ([9053224](https://github.com/ilijaNL/graphql-ws/commit/9053224863ac3ca07dbe990f1332e3f7f79da01d)) +* **client:** Allow keeping the connection alive for some time before lazy closing ([#69](https://github.com/ilijaNL/graphql-ws/issues/69)) ([555c2c3](https://github.com/ilijaNL/graphql-ws/commit/555c2c35b84a864ac5732976e704eed9fcacd08c)) +* **client:** Deprecate `isFatalConnectionProblem` option in favour of `shouldRetry` ([d8dcf21](https://github.com/ilijaNL/graphql-ws/commit/d8dcf219ecb55241d4a99d500eae69de564651f4)) +* **client:** Emit events for `connecting`, `connected` and `closed` ([627775b](https://github.com/ilijaNL/graphql-ws/commit/627775b8e1aca8f359607020ff2c3bcc37b50787)) +* **client:** Implement silent-reconnects ([c6f7872](https://github.com/ilijaNL/graphql-ws/commit/c6f7872126300befcc47e8e46e82342c2924f453)), closes [#7](https://github.com/ilijaNL/graphql-ws/issues/7) +* **client:** introduce Socky 🧦 - the nifty internal socket state manager ([#8](https://github.com/ilijaNL/graphql-ws/issues/8)) ([a4bee6f](https://github.com/ilijaNL/graphql-ws/commit/a4bee6fb8c1bd56637363a76f6ab0c3b64f55931)) +* **client:** Lazy option can be changed ([fb0ec14](https://github.com/ilijaNL/graphql-ws/commit/fb0ec1478e5219eb75e6bf2a1c2fd2a3a9cbb90d)) +* **client:** Optional `generateID` to provide subscription IDs ([#22](https://github.com/ilijaNL/graphql-ws/issues/22)) ([9a3f54a](https://github.com/ilijaNL/graphql-ws/commit/9a3f54a8198379b402a8abe414ab5727ccec45cf)), closes [#21](https://github.com/ilijaNL/graphql-ws/issues/21) +* **client:** Provide subscribe payload in `generateID` ([d0bc6e1](https://github.com/ilijaNL/graphql-ws/commit/d0bc6e15169285421fc7961c712d1d07c884a14e)), closes [#398](https://github.com/ilijaNL/graphql-ws/issues/398) +* **client:** Re-implement following the new transport protocol ([#6](https://github.com/ilijaNL/graphql-ws/issues/6)) ([5191a35](https://github.com/ilijaNL/graphql-ws/commit/5191a358098c6f9a661ae90e0420fa430db9152c)) +* **client:** Rename `keepAlive` option to `lazyCloseTimeout` ([3c1f13c](https://github.com/ilijaNL/graphql-ws/commit/3c1f13cd49ee00d7da80f3950eef8f414d909d58)) +* **client:** Retry with randomised exponential backoff or provide your own strategy ([#84](https://github.com/ilijaNL/graphql-ws/issues/84)) ([d3e7a17](https://github.com/ilijaNL/graphql-ws/commit/d3e7a171603a3ef181c5af533768dcda416a1731)) +* **client:** Support providing custom WebSocket implementations ([#18](https://github.com/ilijaNL/graphql-ws/issues/18)) ([1515fe2](https://github.com/ilijaNL/graphql-ws/commit/1515fe2adcc0bb2b18a1309550f4e41528985f54)) +* **client:** Terminate the WebSocket abruptly and immediately ([53ad515](https://github.com/ilijaNL/graphql-ws/commit/53ad5156e85f358bfa1baa81f9787b6a8479527d)), closes [#290](https://github.com/ilijaNL/graphql-ws/issues/290) +* Descriptive invalid message errors ([b46379e](https://github.com/ilijaNL/graphql-ws/commit/b46379e5946b8ce10e907588399350b8ba256c4c)), closes [#366](https://github.com/ilijaNL/graphql-ws/issues/366) +* Optional `payload` for ping/pong message types ([2fe0345](https://github.com/ilijaNL/graphql-ws/commit/2fe03453e32112598af0faeecf054c899e658c1d)), closes [#117](https://github.com/ilijaNL/graphql-ws/issues/117) +* Package ECMAScript Modules too ([#87](https://github.com/ilijaNL/graphql-ws/issues/87)) ([2108174](https://github.com/ilijaNL/graphql-ws/commit/2108174eb5e1f48656287a2e55adc67112a05314)) +* Package rename `@enisdenjo/graphql-transport-ws` 👉 `graphql-transport-ws`. ([494f676](https://github.com/ilijaNL/graphql-ws/commit/494f6766279325769e81f52ce7b4b442c85f9476)) +* Rewrite GraphQL over WebSocket Protocol ([#2](https://github.com/ilijaNL/graphql-ws/issues/2)) ([42045c5](https://github.com/ilijaNL/graphql-ws/commit/42045c577de9d95a81a37d850b38f4482914cebd)) +* Send optional payload with the `ConnectionAck` message ([#60](https://github.com/ilijaNL/graphql-ws/issues/60)) ([1327e77](https://github.com/ilijaNL/graphql-ws/commit/1327e7735fc52f8318644b0f4cec86d3288a0e68)) +* **server:** `context` may return a promise ([cd5c2f8](https://github.com/ilijaNL/graphql-ws/commit/cd5c2f8d0f9d11889052601c0fabdb8c6ed607fa)), closes [#74](https://github.com/ilijaNL/graphql-ws/issues/74) +* **server:** `execute` and `subscribe` are optional ([#148](https://github.com/ilijaNL/graphql-ws/issues/148)) ([af748b0](https://github.com/ilijaNL/graphql-ws/commit/af748b0fd34da44950bd7fbbaeeebf743ff6973e)) +* **server:** Add `onClose` callback for closures at _any_ point in time ([dd0d4fa](https://github.com/ilijaNL/graphql-ws/commit/dd0d4fa7828974b27876e138c0d09f78b2721d2d)) +* **server:** Add `onDisconnect` callback ([#94](https://github.com/ilijaNL/graphql-ws/issues/94)) ([2a61268](https://github.com/ilijaNL/graphql-ws/commit/2a612687d2b3fe7dc9a62dca5a171a52c28b99ab)) +* **server:** Add support for `ws@v8` ([9119153](https://github.com/ilijaNL/graphql-ws/commit/911915351ea58816db94c8eccfd4226462e2c8b7)) +* **server:** Define execution/subscription `context` in creation options ([5b3d253](https://github.com/ilijaNL/graphql-ws/commit/5b3d25351cdd2714a1edb9833ab2c2c7a9316944)), closes [#13](https://github.com/ilijaNL/graphql-ws/issues/13) +* **server:** Dynamic `schema` support by accepting a function or a Promise ([#147](https://github.com/ilijaNL/graphql-ws/issues/147)) ([6a0bf94](https://github.com/ilijaNL/graphql-ws/commit/6a0bf9473e6bc77afdaf81d16eeeeddcbe97276f)), closes [#127](https://github.com/ilijaNL/graphql-ws/issues/127) +* **server:** For dynamic usage, `context` option can be a function too ([#46](https://github.com/ilijaNL/graphql-ws/issues/46)) ([149b582](https://github.com/ilijaNL/graphql-ws/commit/149b58266859d6f275c186581f71c3aff52cb4a3)) +* **server:** Implement following the new transport protocol ([#1](https://github.com/ilijaNL/graphql-ws/issues/1)) ([a412d25](https://github.com/ilijaNL/graphql-ws/commit/a412d2570e484046a058c11f39813c7794ec9147)) +* **server:** Log a warning for unsupported subprotocols ([88a12ef](https://github.com/ilijaNL/graphql-ws/commit/88a12ef3d9261e787a150d226210856688bf97da)), closes [#92](https://github.com/ilijaNL/graphql-ws/issues/92) +* **server:** Make and use with your own flavour ([#64](https://github.com/ilijaNL/graphql-ws/issues/64)) ([38bde87](https://github.com/ilijaNL/graphql-ws/commit/38bde87122f4c39b0357c636fd98bfee886dd6e5)), closes [#61](https://github.com/ilijaNL/graphql-ws/issues/61) [#73](https://github.com/ilijaNL/graphql-ws/issues/73) [#75](https://github.com/ilijaNL/graphql-ws/issues/75) +* **server:** More callbacks, clearer differences and higher extensibility ([#40](https://github.com/ilijaNL/graphql-ws/issues/40)) ([507a222](https://github.com/ilijaNL/graphql-ws/commit/507a2226719efacf6180705beb8bb9d88f80d7f3)) +* **server:** Optional `onPing` and `onPong` message type listeners ([f36066f](https://github.com/ilijaNL/graphql-ws/commit/f36066f820ba2b2fabb728c77ca17b5ea5b8e6da)) +* **server:** Pass roots for operation fields as an option ([dcb5ed4](https://github.com/ilijaNL/graphql-ws/commit/dcb5ed4dcc3c4569b104b2cbe9979161fad2ff0a)) +* **server:** Support returning multiple results from `execute` ([#28](https://github.com/ilijaNL/graphql-ws/issues/28)) ([dbbd88b](https://github.com/ilijaNL/graphql-ws/commit/dbbd88bb26843da55d9558e7a44bff3108f095ab)) +* **server:** Use `@fastify/websocket` ([#382](https://github.com/ilijaNL/graphql-ws/issues/382)) ([dd755b0](https://github.com/ilijaNL/graphql-ws/commit/dd755b0bb872b0daf79f53e484a16e868315a655)), closes [#381](https://github.com/ilijaNL/graphql-ws/issues/381) +* **server:** Use `fastify-websocket` ([#200](https://github.com/ilijaNL/graphql-ws/issues/200)) ([b62fc95](https://github.com/ilijaNL/graphql-ws/commit/b62fc958bb0b67224d3c1b684d441bd8349c4b8a)) +* **server:** Use `validate` option for custom GraphQL validation ([b68d56c](https://github.com/ilijaNL/graphql-ws/commit/b68d56ca1ffb8c7375d4292f716a63326d9d712f)) +* **server:** Use uWebSockets ([#89](https://github.com/ilijaNL/graphql-ws/issues/89)) ([45d08fc](https://github.com/ilijaNL/graphql-ws/commit/45d08fcb9fde4159dea3f131f865f5d5bf5041d2)), closes [#61](https://github.com/ilijaNL/graphql-ws/issues/61) +* Subscribe message `query` must be a string ([#45](https://github.com/ilijaNL/graphql-ws/issues/45)) ([60d9cd5](https://github.com/ilijaNL/graphql-ws/commit/60d9cd5509d1b989f3ca6a9370850ce0aae41522)) +* Support custom JSON message `reviver` and `replacer` ([#172](https://github.com/ilijaNL/graphql-ws/issues/172)) ([0a9894e](https://github.com/ilijaNL/graphql-ws/commit/0a9894e21c42e70158ad65f045c8467c7177d4fa)) +* TypeScript generic for connection init payload (`connectionParams`) ([#311](https://github.com/ilijaNL/graphql-ws/issues/311)) ([e67cf80](https://github.com/ilijaNL/graphql-ws/commit/e67cf807396ca45b1198ff4bb64e44b55778e1f8)) +* **use:** Generic for extending the context extras ([401cd4c](https://github.com/ilijaNL/graphql-ws/commit/401cd4ce335e11dcf139502da3aa7dc1f23651c5)), closes [#189](https://github.com/ilijaNL/graphql-ws/issues/189) +* **uWebSockets:** Add `persistedRequest` to context extra and deprecate uWS's stack allocated `request` ([#196](https://github.com/ilijaNL/graphql-ws/issues/196)) ([736e6ed](https://github.com/ilijaNL/graphql-ws/commit/736e6eda45d392292f315b9465b104dce4f2545f)) +* **uWebSockets:** Drop deprecated `request` context extra ([02ea5ee](https://github.com/ilijaNL/graphql-ws/commit/02ea5ee8cfe918d547608c69482911e3d6091290)) +* WebSocket Ping and Pong as keep-alive ([#11](https://github.com/ilijaNL/graphql-ws/issues/11)) ([16ae316](https://github.com/ilijaNL/graphql-ws/commit/16ae316b35a90d45f379336ec3ed5bedf3f2e28e)) + + +### Performance Improvements + +* **client:** Await timeouts only in recursive connects ([55c8fc8](https://github.com/ilijaNL/graphql-ws/commit/55c8fc8aba5dfb5ff3c66a11946f85ec631b1d41)) +* **client:** Focus subscription message listeners on `id` ([#150](https://github.com/ilijaNL/graphql-ws/issues/150)) ([32c2268](https://github.com/ilijaNL/graphql-ws/commit/32c22686984e6f3c98388b31a08471c3e4ee96a6)) +* **client:** Memoize message parsing for each subscriber ([2a7ba46](https://github.com/ilijaNL/graphql-ws/commit/2a7ba4642c0ea1a3294b8b3ea3440957ec7fcb7b)) +* Easier message parser ([d44c6f1](https://github.com/ilijaNL/graphql-ws/commit/d44c6f18ccd2bc539bb541e6bfd1bf0c769c7856)) +* Reduce runtime prototype traversal for hasOwnProperty ([#52](https://github.com/ilijaNL/graphql-ws/issues/52)) ([1bb9218](https://github.com/ilijaNL/graphql-ws/commit/1bb9218ad3ee9442442122c1d10910d51951b763)) + + +### Reverts + +* Revert "refactor: emit client connect in next tick during testing" ([c10d0bf](https://github.com/ilijaNL/graphql-ws/commit/c10d0bfa7303430dd57f9580b20353c2f32b0951)) + + +### BREAKING CHANGES + +* Because of the Protocol's strictness, an instant connection termination will happen whenever an invalid message is identified; meaning, all previous implementations will fail when receiving the new subprotocol ping/pong messages. + +**Beware,** the client will NOT ping the server by default. Please make sure to upgrade your stack in order to support the new ping/pong message types. + +A simple recipe showcasing a client that times out if no pong is received and measures latency, looks like this: +```js +import { createClient } from 'graphql-ws'; + +let activeSocket, + timedOut, + pingSentAt = 0, + latency = 0; +createClient({ + url: 'ws://i.time.out:4000/and-measure/latency', + keepAlive: 10_000, // ping server every 10 seconds + on: { + connected: (socket) => (activeSocket = socket), + ping: (received) => { + if (!received /* sent */) { + pingSentAt = Date.now(); + timedOut = setTimeout(() => { + if (activeSocket.readyState === WebSocket.OPEN) + activeSocket.close(4408, 'Request Timeout'); + }, 5_000); // wait 5 seconds for the pong and then close the connection + } + }, + pong: (received) => { + if (received) { + latency = Date.now() - pingSentAt; + clearTimeout(timedOut); // pong is received, clear connection close timeout + } + }, + }, +}); +``` +* **uWebSockets:** The deprecated uWebSockets `request` context extra field has been dropped because it is stack allocated and cannot be used ouside the internal `upgrade` callback. +* **client:** Client `keepAlive` option has been renamed to `lazyCloseTimeout` in order to eliminate ambiguity with the client to server pings keep-alive option. +* **server:** The return function of `server.opened` (`closed`) now requires the close event code and reason for reporting to the `onDisconnect` callback. +* **server:** The `Context.subscriptions` record value can be either an `AsyncIterator` or a `Promise`. +* **client:** Client `retryTimeout` option has been replaced with the new `retryWait`. + +`retryWait` allows you to control the retry timeout strategy by resolving the returned promise when ready. The default implements the randomised exponential backoff like so: +```ts +// this is the default +const retryWait = async function randomisedExponentialBackoff(retries: number) { + let retryDelay = 1000; // start with 1s delay + for (let i = 0; i < retries; i++) { + retryDelay *= 2; // square `retries` times + } + await new Promise((resolve) => + setTimeout( + // resolve pending promise with added random timeout from 300ms to 3s + resolve, + retryDelay + Math.floor(Math.random() * (3000 - 300) + 300), + ), + ); +}; +``` +* **server:** You now "make" a ready-to-use server that can be used with _any_ WebSocket implementation! + +Summary of breaking changes: +- No more `keepAlive`. The user should provide its own keep-alive implementation. _(I highly recommend [WebSocket Ping and Pongs](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers#Pings_and_Pongs_The_Heartbeat_of_WebSockets))_ +- No more HTTP `request` in the server context. +- No more WebSocket in the server context (you're the one that creates it). +- You use your own WebSocket server +- Server exports only `makeServer` _(no more `createServer`)_ + +### Benefits +- You're responsible for the server (_any_ optimisation or adjustment can be applied) +- Any WebSocket server can be used (or even mocked if necessary) +- You control the disposal of the server (close or transfer clients however you wish) +- New `extra` field in the `Context` for storing custom values useful for callbacks +- Full control of authentication flow +- Full control over error handling +- True zero-dependency + +### Migrating from v1 + +**Only the server has to be migrated.** Since this release allows you to use your favourite WebSocket library (or your own implementation), using [ws](https://github.com/websockets/ws) is just one way of using `graphql-ws`. This is how to use the implementation shipped with the lib: + +```ts +/** + * ❌ instead of the lib creating a WebSocket server internally with the provided arguments + */ +import https from 'https'; +import { createServer } from 'graphql-ws'; + +const server = https.createServer(...); + +createServer( + { + onConnect(ctx) { + // were previously directly on the context + ctx.request as IncomingRequest + ctx.socket as WebSocket + }, + ...rest, + }, + { + server, + path: '/graphql', + }, +); + +/** + * ✅ you have to supply the server yourself + */ +import https from 'https'; +import ws from 'ws'; // yarn add ws +import { useServer } from 'graphql-ws/lib/use/ws'; // notice the import path + +const server = https.createServer(...); +const wsServer = new ws.Server({ + server, + path: '/graphql', +}); + +useServer( + { + onConnect(ctx) { + // are now in the `extra` field + ctx.extra.request as IncomingRequest + ctx.extra.socket as WebSocket + }, + ...rest, + }, + wsServer, + // optional keepAlive with ping pongs (defaults to 12 seconds) +); +``` +* This lib is no longer compatible with [`subscriptions-transport-ws`](https://github.com/apollographql/subscriptions-transport-ws). It follows a redesigned transport protocol aiming to improve security, stability and reduce ambiguity. + # [5.12.0](https://github.com/enisdenjo/graphql-ws/compare/v5.11.3...v5.12.0) (2023-03-06) diff --git a/package.json b/package.json index 03ff9b38..5fe20311 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ilijanl/graphql-ws-graphqless", - "version": "5.12.0", + "version": "1.0.0", "description": "Coherent, zero-dependency, lazy, simple, based on graphql websocket protocol, compliant server and client", "keywords": [ "protocol",