Closed Tripple-A closed 10 months ago
Hey!
Looks like you haven't configured history support at the server-side (currently, it's opt-in). You should provide the broker configuration (see docs; the easiest way is to provide the --presets=broker
option for anycable-go
.
I found the manual configuration to work just fine out of the box. Thank you!
OBSERVATION
With the change to redisx
adapter in the yml
file and using the --presets=broker
command, stream broadcasts do not work out of the box. Seems like changing the adapter alone is not sufficient and some extra configuration is needed.
The output seems same as the manual config, however, this is the difference I notice:
PRESET
$ anycable-go --presets=broker
.......
INFO 2024-01-18T03:46:28.489Z context=broadcast provider=http Accept broadcast requests at http://localhost:8090/_broadcast
.......
MANUAL
$ anycable-go --broker=memory --broadcast_adapter=redisx
.......
INFO 2024-01-18T06:25:21.695Z consumer=xzIgMq context=broadcast id=xzIgMq provider=redisx stream=__anycable__ Starting Redis broadcaster at localhost:6379
.......
With preset, the provider is set as http, instead of redisx, despite being stated in the yml file as redisx.
FULL PRESET LOGS
$ anycable-go --presets=broker
INFO 2024-01-18T06:33:58.607Z context=config Load presets: broker
INFO 2024-01-18T06:33:58.607Z context=main Starting AnyCable 1.4.8 (pid: 94051, open file limit: 61440, gomaxprocs: 10)
INFO 2024-01-18T06:33:58.607Z context=main Anonymized telemetry is on. Learn more: https://docs.anycable.io/anycable-go/telemetry
INFO 2024-01-18T06:33:58.607Z context=main Using in-memory broker (epoch: 9GT_, history limit: 100, history ttl: 300s, sessions ttl: 300s)
WARN 2024-01-18T06:33:58.607Z context=main Using a non-distributed broadcaster without a pub/sub enabled; each broadcasted message is only processed by a single node
INFO 2024-01-18T06:33:58.607Z context=broadcast provider=http Accept broadcast requests at http://localhost:8090/_broadcast
INFO 2024-01-18T06:33:58.608Z context=rpc RPC controller initialized: localhost:50051 (concurrency: 28, impl: grpc, enable_tls: false, proto_versions: v1)
INFO 2024-01-18T06:33:58.608Z context=main Handle WebSocket connections at http://localhost:8080/cable
INFO 2024-01-18T06:33:58.608Z context=main Handle health requests at http://localhost:8080/health
WARN 2024-01-18T06:34:06.701Z context=node sid=bUp4kkI2O7Z70qpR20xJd Failed to handle incoming message '{"command":"subscribe","identifier":"{\"channel\":\"Turbo::StreamsChannel\",\"signed_stream_name\":\"ImJvb2tzIg==--7d6448fb141034dacfe0e78daf6fed7d6c1e95c39a740379b1fdf83cd29b5274\"}","history":{"since":1705559629,"streams":{"messages":{"epoch":"9P7c","offset":15}}}}' with error: Unknown epoch: 9P7c, current: 9GT_
2024/01/18 07:34:36 ERROR: [transport] Client received GoAway with error code ENHANCE_YOUR_CALM and debug data equal to ASCII "too_many_pings".
2024/01/18 07:35:56 ERROR: [transport] Client received GoAway with error code ENHANCE_YOUR_CALM and debug data equal to ASCII "too_many_pings".
2024/01/18 07:38:36 ERROR: [transport] Client received GoAway with error code ENHANCE_YOUR_CALM and debug data equal to ASCII "too_many_pings".
Maybe I missed something in the documentation as I found only this info stated here about redisx
, and it is in regard to the stream_name
.
Thank you!
With preset, the provider is set as http, instead of redisx, despite being stated in the yml file as redisx.
YAML config is only used by the Ruby library. And, yes, the broker
preset makes no assumptions regarding Redis, so it configures the only dependency-free adapter, HTTP. RedisX must be always specified explicitly for now.
Environment npm packages: @anycable/turbo-stream @ 0.4.0 @anycable/core @ 0.7.12 @anycable/web @ 0.7.3
AnyCable-Go version: 1.4.8 AnyCable gem version: anycable-rails (1.4.3) anycable (1.4.3)
Application.js
Partial
Index
Error - History Not Supported
Expectation Resumability is possible.
Actual Behaviour The
subscribe
command is called, thereject_history
type of message is received. No messages sent during the "offline" state is received. Thesince
param is properly set but thestreams
are an empty hash.Screenshots
Question Are there any other configurations required for
History
to be supported when the AnyCable JS client is used with turbo streams?Thank you!