A Ruby gem for streaming data from the Bluesky/ATProto firehose

updated readme & changelog

+18 -11
+17 -11
CHANGELOG.md
··· 7 7 - added `Skyfall::Jetstream::CommitMessage#operation` (aliased as `op`) which returns the (always single) operation in the `operations` array 8 8 - added `#kind` as alias for `#type` in both `Message` classes 9 9 - added a base class for error types, `Skyfall::Error` 10 + - added `#blocks` to `SyncMessage` 10 11 11 12 Deprecated & removed APIs: 12 13 ··· 22 23 - restricted `#inspectable_variables` methods access to either private or protected 23 24 - relaxed `Stream#build_websocket_url` & `Stream#build_websocket_client` methods access from private to protected 24 25 - fixed private class method `Skyfall::Firehose::Message.decode_cbor_objects` which wasn't actually private 26 + 27 + Optimizations: 28 + 29 + - much faster `Skyfall::Firehose::Message#time` parsing on Ruby 3.2+ 30 + - lazy decoding of sections in `CarArchive` – saves quite a lot of work if sections are only accessed through `Operation#raw_record` 31 + - added `frozen_string_literal: true` in all files to reduce garbage collection 25 32 26 33 Additional validations and other changes: 27 34 ··· 30 37 - `Message` subclasses raise an error if `.new` is called on a subclass (and not on the base `Message`) passing the data of a wrong kind of message (instead of returning e.g. a `CommitMessage` from `AccountMessage.new` as it worked previously) 31 38 - made `LabelsMessage` a subclass of `Firehose::Message` 32 39 - fixed the `require`s config in some files so they can be loaded in any order 33 - - added `frozen_string_literal: true` in all files to reduce garbage collection 34 40 35 41 36 42 ## [0.6.1] - 2026-01-08 ··· 42 48 43 49 ## [0.6.0] - 2025-06-25 44 50 45 - - significantly speeded up reading of events from the binary firehose (`Skyfall::Firehose`) - up to 4-5x faster than before 51 + - significantly speeded up reading of events from the binary firehose (`Skyfall::Firehose`) – up to 4-5x faster than before 46 52 - removed the `Skyfall::Stream.new` constructor deprecated in 0.5.0 47 53 48 54 ## [0.5.1] - 2025-05-18 ··· 65 71 66 72 In most cases, you should only need to update the `Skyfall::Stream` class name in the constructor. If you've referenced message classes like `Skyfall::CommitMessage` directly, it's probably better to just check the `#type` property instead. 67 73 68 - Also, small change to the user agent API: `Skyfall::Stream` now has an additional metod `version_string`, which will always return `Skyfall/0.x.y` - it's recommended to use that instead of `default_user_agent` to build your own user agent string that includes the library version. `default_user_agent` now passes through to `version_string`, but it could be changed in future to return something else. 74 + Also, small change to the user agent API: `Skyfall::Stream` now has an additional metod `version_string`, which will always return `Skyfall/0.x.y` – it's recommended to use that instead of `default_user_agent` to build your own user agent string that includes the library version. `default_user_agent` now passes through to `version_string`, but it could be changed in future to return something else. 69 75 70 76 ## [0.4.1] - 2024-10-04 71 77 72 - - performance fix - don't decode CAR sections which aren't needed, which is most of them; this cuts the amount of memory that GC has to free up by about one third, and should speed up processing by around ~10% 78 + - performance fix – don't decode CAR sections which aren't needed, which is most of them; this cuts the amount of memory that GC has to free up by about one third, and should speed up processing by around ~10% 73 79 74 80 ## [0.4.0] - 2024-09-23 75 81 ··· 83 89 - added `#account` event type (`AccountMessage`) 84 90 - added `handle` field to `IdentityMessage` 85 91 - fixed param validation on `Stream` initialization 86 - - reverted the change that added Ruby stdlib dependencies explicitly to the gemspec, since this causes more problems than it's worth - only `base64` is left there, since it's the one now required to be listed 92 + - reverted the change that added Ruby stdlib dependencies explicitly to the gemspec, since this causes more problems than it's worth – only `base64` is left there, since it's the one now required to be listed 87 93 88 94 ## [0.3.0] - 2024-03-21 89 95 90 96 - added support for labeller firehose, served by labeller services at the `com.atproto.label.subscribeLabels` endpoint (aliased as `:subscribe_labels`) 91 97 - the `#labels` messages from the labeller firehose are parsed into a `LabelsMessage`, which includes a `labels` array of `Label` objects 92 98 - `Stream` callbacks can now also be assigned via setters, e.g. `stream.on_message = proc { ... }` 93 - - added default error handler to `Stream` which logs the error to `$stdout` - set `stream.on_error = nil` to disable 94 - - added Ruby stdlib dependencies explicitly to the gemspec - fixes a warning in Ruby 3.3 when requiring `base64`, which will be extracted as an optional gem in 3.4 99 + - added default error handler to `Stream` which logs the error to `$stdout` – set `stream.on_error = nil` to disable 100 + - added Ruby stdlib dependencies explicitly to the gemspec – fixes a warning in Ruby 3.3 when requiring `base64`, which will be extracted as an optional gem in 3.4 95 101 96 102 ## [0.2.5] - 2024-03-14 97 103 ··· 118 124 119 125 ## [0.2.1] - 2023-08-19 120 126 121 - - optimized `WebsocketMessage` parsing performance - lazy parsing of most properties (message decoding should be over 50% faster on average) 127 + - optimized `WebsocketMessage` parsing performance – lazy parsing of most properties (message decoding should be over 50% faster on average) 122 128 - added separate subclasses of `WebsocketMessage` for different message types 123 129 - added support for `#handle`, `#info` and `#tombstone` message types 124 130 - `UnknownMessage` is returned for unrecognized message types ··· 126 132 ## [0.2.0] - 2023-07-24 127 133 128 134 - switched the websocket library from `websocket-client-simple` to `faye-websocket`, which should make event parsing up to ~30× faster (!) 129 - - added `auto_reconnect` property to `Stream` (on by default) - if true, it will try to reconnect with an exponential backoff when the websocket disconnects, until you call `Stream#disconnect` 135 + - added `auto_reconnect` property to `Stream` (on by default) – if true, it will try to reconnect with an exponential backoff when the websocket disconnects, until you call `Stream#disconnect` 130 136 131 137 Note: 132 138 133 - - calling `sleep` is no longer needed after connecting - call `connect` on a new thread instead to get previously default behavior of running the event loop asynchronously 139 + - calling `sleep` is no longer needed after connecting – call `connect` on a new thread instead to get previously default behavior of running the event loop asynchronously 134 140 - the disconnect event no longer passes an error object in the argument 135 - - there is currently no "heartbeat" feature as in 0.1.x that checks for a stuck connection - but it doesn't seem to be needed 141 + - there is currently no "heartbeat" feature as in 0.1.x that checks for a stuck connection – but it doesn't seem to be needed 136 142 137 143 ## [0.1.3] - 2023-07-04 138 144
+1
README.md
··· 130 130 - `CommitMessage` (`#commit`) - represents a change in a user's repo; most messages are of this type 131 131 - `IdentityMessage` (`#identity`) - notifies about a change in user's DID document, e.g. a handle change or a migration to a new PDS 132 132 - `AccountMessage` (`#account`) - notifies about a change of an account's status (de/activation, suspension, deletion) 133 + - `SyncMessage` (`#sync`) - updates repository state, can be used to trigger account resynchronization 133 134 - `LabelsMessage` (`#labels`) - only used in `subscribe_labels` endpoint 134 135 - `InfoMessage` (`#info`) - a protocol error message, e.g. about an invalid cursor parameter 135 136 - `UnknownMessage` is used for other unrecognized message types