package
0.34.4
Repository: https://github.com/256dpi/fire.git
Documentation: pkg.go.dev

# README

spark

Package spark implements a simple pub/sub mechanism that allows clients to watch resources.

WebSocket

To watch resources, the client initiates a WebSocket connection to the group action:

wss://example.com/v1/api/watch

And then subscribes to streams:

{
  "subscribe": {
    "items": {
      "state": true
    } 
  }
}

The server then forwards matching events to the client:

{
  "items": {
    "5c880eb87b0a67df9a6a2efc": "created"
  } 
}

If necessary, the client can unsubscribe from streams:

{
  "unsubscribe": ["items"]
}

# Functions

NewWatcher creates and returns a new watcher.

# Structs

Event describes an event.
Stream describes a single model stream and how clients can subscribe to it.
Subscription is a single subscription to a stream by a client.
Watcher will watch multiple collections and serve watch requests by clients.

# Type aliases

Map holds custom data for a subscription.