Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support websockets #13

Open
richardartoul opened this issue Jan 8, 2023 · 7 comments
Open

Support websockets #13

richardartoul opened this issue Jan 8, 2023 · 7 comments

Comments

@richardartoul
Copy link
Owner

Not sure exactly what this should look like, but for Actor it would be nice to be able to establish websocket connections to them to make it easier to implement realtime applications like chat and games.

@gedw99
Copy link

gedw99 commented Feb 20, 2023

Nats does web sockets and can leverage the many FDB instances as it was client side load balancing

The whole actor system with FDM seems like a great match with NATS.

i use nats with Wazero.

Nats has a KV and Blob store and so can act as a store and forward network into Nola too .

nats.go also compilesvto wasm . I use it inside browsers where it makes web socket connects to the nats server

@richardartoul
Copy link
Owner Author

Never heard of NATS until now. Looks interesting. Are you using it for messaging only or are you also using jet stream?

@gedw99
Copy link

gedw99 commented Feb 20, 2023

I use it for serverless, because it is a control pane and a data plane. So you can configure an endpoint for a massage exchange, and then let many Actor use that endpoints. You can also secure that endpoint and create users ( which the actors will i guess impersonate ) - see the NSC tool.

In terms of transpots you get NATS, WS and MQTT. Its easy to also make it work over http. you can even stick Caddy in front of it and then have both NATS and HTTP routing through it.

Free load balancing because the nats.go client does client side LB.
The NATS Server can be clustered and gatewayed. Typically 3 per DC and 3 DC's is enough for a global setup.
The NATS client will then route to the nearest NATS Server, and then to your Actor and then your WASM Func......
This client ( nats.go ) client can be compiled to wasm and run in a browser even.


Background

NATS is really big and used by Intel, Nokia, Mastercard and many other projects that need a global control plane and data plane that self runs. Been around for 10 years. Before that it was TIBCO Rendevous, but the architect left and created NATS.

NATS can eiher run in mem or use durable store ( aka jetstream ).

When i saw the actors design you had NATS was an obvious thing.
Lots of projects using NATS with Wazero too: https://github.com/bots-garden/capsule

These are the bits you want. Copied out of my makefile:



# NATS-SERVER
# https://github.com/nats-io/nats-server
NATS_SERVER_BIN_NAME=nats-server
#NATS_SERVER_BIN_VERSION=v2.4.5
NATS_SERVER_BIN_VERSION=v2.9.9

# NSC
# https://github.com/nats-io/nsc
NATS_NSC_BIN_NAME=nsc
NATS_NSC_BIN_VERSION=2.7.5

# NATS_TOP
# https://github.com/nats-io/nats-top
NATS_TOP_BIN_NAME=nats-top
NATS_TOP_BIN_VERSION=v0.5.3

# NATS
# https://github.com/nats-io/natscli
NATS_CLI_BIN_NAME=nats
NATS_CLI_BIN_VERSION=v0.0.35

@aratz-lasa
Copy link
Collaborator

aratz-lasa commented Apr 19, 2023

@gedw99 I've heard about NATS many times but have yet to use it. However, wouldn't it require running NATS servers? Since it's a client-server architecture. So this makes the architecture more complex.

@gedw99
Copy link

gedw99 commented May 30, 2023

Nats can run embedded in any golang app . It can run as a leaf node then too. Or it runs can as it’s own server
MIT can firm clusters and global gateways too with self healing .

has baked in security too. And storage ..

kine is a decent example that shows both approaches

https://github.com/k3s-io/kine

https://github.com/k3s-io/kine/blob/master/examples/nats.md

Nokia, Intel. Mastercard and many cloud hyperscakers run it . Not a toy :)

@gedw99
Copy link

gedw99 commented May 30, 2023

I also run wrapped for SSE and quic above it as needed . Web sockets works create as does mqtt.

@gedw99
Copy link

gedw99 commented May 30, 2023

Saw tons of registry issues. I use it as a registry too in lots of projects Nats kv and nats obj Store is useful for these use cases.

docs make it clear so you can check them

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants