devserver

package
v0.0.0-...-5e604c0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2025 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BroadcastFunc

type BroadcastFunc func(Message[any])

type DevWebsockerServer

type DevWebsockerServer struct {
	// contains filtered or unexported fields
}

DevWebsockerServer manages WebSocket connections and file watching

func NewDevWebsocketServer

func NewDevWebsocketServer(options ...WebsocketServerSyncOption) *DevWebsockerServer

NewDevWebsocketServer creates a Websocket file syncing service

func (*DevWebsockerServer) Broadcast

func (fw *DevWebsockerServer) Broadcast(message Message[any])

Broadcast a message to connected clients

func (*DevWebsockerServer) Start

func (fw *DevWebsockerServer) Start() error

Start starts the WebSocket server and file watcher

func (*DevWebsockerServer) Subscribe

func (fw *DevWebsockerServer) Subscribe(subscriber Subscriber) func()

type FileSyncError

type FileSyncError Message[[]schema.ValidationError]

type FileSyncMessage

type FileSyncMessage Message[schema.Application]

type FileSyncOption

type FileSyncOption func(*NitricFileSync)

func WithDebounce

func WithDebounce(debounce time.Duration) FileSyncOption

type Message

type Message[T any] struct {
	Type    string `json:"type"`
	Payload T      `json:"payload"`
}

type NitricFileSync

type NitricFileSync struct {
	// contains filtered or unexported fields
}

func NewFileSync

func NewFileSync(filePath string, broadcast BroadcastFunc, options ...FileSyncOption) (*NitricFileSync, error)

func (*NitricFileSync) Close

func (fs *NitricFileSync) Close() error

func (*NitricFileSync) OnConnect

func (fs *NitricFileSync) OnConnect(send SendFunc)

func (*NitricFileSync) OnMessage

func (fs *NitricFileSync) OnMessage(message json.RawMessage)

func (*NitricFileSync) Start

func (fs *NitricFileSync) Start() error

type NitricProjectBuild

type NitricProjectBuild struct {
	// contains filtered or unexported fields
}

func NewProjectBuild

func NewProjectBuild(apiClient *api.NitricApiClient, builder *build.BuilderService, broadcast BroadcastFunc) (*NitricProjectBuild, error)

func (*NitricProjectBuild) OnConnect

func (n *NitricProjectBuild) OnConnect(send SendFunc)

func (*NitricProjectBuild) OnMessage

func (n *NitricProjectBuild) OnMessage(message json.RawMessage)

type NodePositionSync

type NodePositionSync struct{}

func NewNodePositionSync

func NewNodePositionSync() *NodePositionSync

func (*NodePositionSync) OnConnect

func (nps *NodePositionSync) OnConnect(send SendFunc)

func (*NodePositionSync) OnMessage

func (nps *NodePositionSync) OnMessage(message json.RawMessage)

type NodePositionUpdate

type NodePositionUpdate Message[map[string]XYPosition]

type ProjectBuild

type ProjectBuild struct {
	Target string `json:"target"`
}

type ProjectBuildError

type ProjectBuildError struct {
	Message string `json:"message"`
}

type ProjectBuildSuccess

type ProjectBuildSuccess struct {
	StackPath string `json:"stackPath"`
}

type SendFunc

type SendFunc func(message Message[any])

type Subscriber

type Subscriber interface {
	OnMessage(message json.RawMessage)
	// Provide a function reference that allows the subscriber to send messages to the newly connected client
	OnConnect(send SendFunc)
}

type WebsocketServerSyncOption

type WebsocketServerSyncOption func(*DevWebsockerServer)

Implement additional constructor options

func WithListener

func WithListener(listener net.Listener) WebsocketServerSyncOption

type XYPosition

type XYPosition struct {
	X float64 `json:"x"`
	Y float64 `json:"y"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL