ConnectEverything / nats-whiteboard

Real-time, persistent whiteboards powered by NATS + Jetstream
Other
17 stars 6 forks source link

Update nats.ws to eliminate various deprecations #1

Open gerhardcit opened 3 months ago

gerhardcit commented 3 months ago

This is a great example. Perfect for getting to get you going from scratch.

Project nats.ws = 1.8.1 Current nats.ws = 1.22 and const sub = await nats.jetstream().subscribe("whiteboard", opts); shows that subscribe is deprecated?

Could you possible update this so we don't start of with deprecated options.

I generally find that nats.ws had some minor updates which introduces various deprecations. So the docs and the code samples adds an extra layer of trial and error when you just start of with NATS.

Related to this video https://www.youtube.com/watch?v=As5FojxWViI

gerhardcit commented 3 months ago

I have looked at the examples in https://github.com/nats-io/nats.deno/blob/main/examples/jetstream/05_consume.ts One problem with those examples are that they reference a lot of test util functions in the examples, which makes it difficult to follow the context of the stream manager vs stream and consumer etc.

I would suggest a clean example without test helper utilities for new comers to understand the basic context of setting up a jetstream consumer with websockets without all the noise.

Good examples are like good tests. It's should not depend on any helper functions that confuses the basic usage.

Best examples are ones you can copy and paste and it should work with minimal interference. and then cleanup and optimizes yourself based on your use case.

Having taking some pain in getting it to work easily, I would suggest the lack of easy adaptable examples is a deterrent for newbies and you developers to start using NATS and websockets.