Files
moteva/server/internal/modules/realtime/event.go
T

29 lines
638 B
Go
Raw Normal View History

package realtime
import (
"context"
"encoding/json"
"time"
)
type Event struct {
ID string `json:"id"`
UserID string `json:"userId"`
ProjectID string `json:"projectId"`
ThreadID string `json:"threadId,omitempty"`
Type string `json:"type"`
Payload json.RawMessage `json:"payload,omitempty"`
CreatedAt time.Time `json:"createdAt"`
}
type Bus interface {
Publish(ctx context.Context, event Event) error
Subscribe(ctx context.Context, projectID string) (Subscription, error)
Close() error
}
type Subscription interface {
C() <-chan Event
Close() error
}