Help us shape the future of Go! Take the 2026 Go Developer Survey

web_runtime_sw

package
v0.57.21 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const SRPCServiceWorkerHostServiceID = "web.runtime.sw.ServiceWorkerHost"

Variables

This section is empty.

Functions

func NewSRPCServiceWorkerHostHandler

func NewSRPCServiceWorkerHostHandler(impl SRPCServiceWorkerHostServer, serviceID string) srpc.Handler

NewSRPCServiceWorkerHostHandler constructs a new RPC handler. serviceID: if empty, uses default: web.runtime.sw.ServiceWorkerHost

func NewServiceWorkerHost

func NewServiceWorkerHost(handler ServiceWorkerHandler) *serviceWorkerHost

NewServiceWorkerHost builds the ServiceWorkerHost bound to the Handler.

func SRPCRegisterServiceWorkerHost

func SRPCRegisterServiceWorkerHost(mux srpc.Mux, impl SRPCServiceWorkerHostServer) error

SRPCRegisterServiceWorkerHost registers the implementation with the mux. Uses the default serviceID: web.runtime.sw.ServiceWorkerHost

Types

type SRPCServiceWorkerHostClient

type SRPCServiceWorkerHostClient interface {
	// SRPCClient returns the underlying SRPC client.
	SRPCClient() srpc.Client

	// Fetch proxies a Fetch request with a streaming response.
	Fetch(ctx context.Context) (SRPCServiceWorkerHost_FetchClient, error)
}

func NewSRPCServiceWorkerHostClient

func NewSRPCServiceWorkerHostClient(cc srpc.Client) SRPCServiceWorkerHostClient

func NewSRPCServiceWorkerHostClientWithServiceID

func NewSRPCServiceWorkerHostClientWithServiceID(cc srpc.Client, serviceID string) SRPCServiceWorkerHostClient

type SRPCServiceWorkerHostHandler

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

func (SRPCServiceWorkerHostHandler) GetMethodIDs

func (SRPCServiceWorkerHostHandler) GetMethodIDs() []string

func (*SRPCServiceWorkerHostHandler) GetServiceID

func (d *SRPCServiceWorkerHostHandler) GetServiceID() string

func (*SRPCServiceWorkerHostHandler) InvokeMethod

func (d *SRPCServiceWorkerHostHandler) InvokeMethod(
	serviceID, methodID string,
	strm srpc.Stream,
) (bool, error)

func (SRPCServiceWorkerHostHandler) InvokeMethod_Fetch

type SRPCServiceWorkerHostServer

type SRPCServiceWorkerHostServer interface {
	// Fetch proxies a Fetch request with a streaming response.
	Fetch(SRPCServiceWorkerHost_FetchStream) error
}

type SRPCServiceWorkerHost_FetchClient

type SRPCServiceWorkerHost_FetchClient interface {
	srpc.Stream
	Send(*web_fetch.FetchRequest) error
	Recv() (*web_fetch.FetchResponse, error)
	RecvTo(*web_fetch.FetchResponse) error
}

type SRPCServiceWorkerHost_FetchStream

type SRPCServiceWorkerHost_FetchStream interface {
	srpc.Stream
	Send(*web_fetch.FetchResponse) error
	SendAndClose(*web_fetch.FetchResponse) error
	Recv() (*web_fetch.FetchRequest, error)
	RecvTo(*web_fetch.FetchRequest) error
}

type ServiceWorkerHandler

type ServiceWorkerHandler interface {
	// HandleFetch handles an incoming Fetch request from the ServiceWorker.
	// The Client ID can be used to distinguish between windows / browser tabs.
	HandleFetch(strm fetch.SRPCFetchService_FetchStream) error
}

ServiceWorkerHandler is the handler for the ServiceWorker.

Jump to

Keyboard shortcuts

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