server

package
v3.0.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: MIT Imports: 12 Imported by: 0

README

Server Plugin

This plugin provides a simple server for your Wails applications to make them accessible over the local network. Bidirectional communication occurs over a websocket connection.

Installation

Add the plugin to the Plugins option in the Applications options:

package main

import (
    "github.com/wailsapp/wails/v3/pkg/application"
    "github.com/wailsapp/wails/v3/plugins/server"
)

func main() {
    app := application.New(application.Options{
        // ...
        Plugins: map[string]application.Plugin{
            "server": server.NewPlugin(&server.Config{
                Host: "0.0.0.0",
                Port: 31115,
            }),
        },
    })

Support

If you find a bug in this plugin, please raise a ticket on the Wails Issue Tracker.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Address string
}

type Config

type Config struct {
	Host    string
	Port    int
	Enabled bool
	Headers map[string]string
}

func (Config) ListenAddress

func (c Config) ListenAddress() string

type Consumer

type Consumer struct{}

func (Consumer) Header

func (c Consumer) Header() http.Header

func (Consumer) Write

func (c Consumer) Write(data []byte) (int, error)

func (Consumer) WriteHeader

func (c Consumer) WriteHeader(statusCode int)

type Plugin

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

func NewPlugin

func NewPlugin(config *Config) *Plugin

func (*Plugin) CallableByJS

func (s *Plugin) CallableByJS() []string

func (*Plugin) Init

func (p *Plugin) Init() error

Init is called when the plugin is loaded. It is passed the application.App instance. This is where you should do any setup.

func (*Plugin) InjectJS

func (p *Plugin) InjectJS() string

func (*Plugin) Name

func (s *Plugin) Name() string

Name returns the name of the plugin.

func (*Plugin) Shutdown

func (s *Plugin) Shutdown()

Shutdown will stop the server

type Server

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

func NewServer

func NewServer(config *Config) *Server

func (*Server) Info

func (s *Server) Info(msg string)

func (*Server) Shutdown

func (s *Server) Shutdown()

type Window

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

func (Window) AbsolutePosition

func (w Window) AbsolutePosition() (x, y int)

func (Window) CallError

func (w Window) CallError(callID string, result string)

func (Window) CallResponse

func (w Window) CallResponse(callID string, result string)

func (Window) Center

func (w Window) Center()

func (Window) Close

func (w Window) Close()

func (Window) Destroy

func (w Window) Destroy()

func (Window) DialogError

func (w Window) DialogError(dialogID string, result string)

func (Window) DialogResponse

func (w Window) DialogResponse(dialogID string, result string, isJSON bool)

func (Window) DisableSizeConstraints

func (w Window) DisableSizeConstraints()

func (Window) DispatchWailsEvent

func (w Window) DispatchWailsEvent(event *application.WailsEvent)

func (Window) EnableSizeConstraints

func (w Window) EnableSizeConstraints()

func (Window) Error

func (w Window) Error(message string, args ...any)

func (Window) ExecJS

func (w Window) ExecJS(callID, js string)

func (Window) Focus

func (w Window) Focus()

func (Window) ForceReload

func (w Window) ForceReload()

func (Window) Fullscreen

func (w Window) Fullscreen() application.Window

func (Window) GetScreen

func (w Window) GetScreen() (*application.Screen, error)

func (Window) GetZoom

func (w Window) GetZoom() float64

func (Window) HandleDragAndDropMessage

func (w Window) HandleDragAndDropMessage(filenames []string)

func (Window) HandleKeyEvent

func (w Window) HandleKeyEvent(acceleratorString string)

func (Window) HandleMessage

func (w Window) HandleMessage(message string)

func (Window) HandleWindowEvent

func (w Window) HandleWindowEvent(id uint)

func (Window) Height

func (w Window) Height() int

func (Window) Hide

func (w Window) Hide() application.Window

func (Window) ID

func (w Window) ID() uint

func (Window) Info

func (w Window) Info(message string, args ...any)

func (Window) IsFullscreen

func (w Window) IsFullscreen() bool

func (Window) IsMaximised

func (w Window) IsMaximised() bool

func (Window) IsMinimised

func (w Window) IsMinimised() bool

func (Window) Maximise

func (w Window) Maximise() application.Window

func (Window) Minimise

func (w Window) Minimise() application.Window

func (Window) Minimize

func (w Window) Minimize()

func (Window) Name

func (w Window) Name() string

func (Window) On

func (w Window) On(eventType events.WindowEventType, callback func(ctx *application.WindowEvent)) func()

func (Window) OpenContextMenu

func (w Window) OpenContextMenu(data *application.ContextMenuData)

func (Window) Position

func (w Window) Position() (int, int)

func (Window) RegisterContextMenu

func (w Window) RegisterContextMenu(name string, menu *application.Menu)

func (Window) RelativePosition

func (w Window) RelativePosition() (x, y int)

func (Window) Reload

func (w Window) Reload()

func (Window) Resizable

func (w Window) Resizable() bool

func (Window) Restore

func (w Window) Restore()

func (Window) Run

func (w Window) Run()

func (Window) SetAbsolutePosition

func (w Window) SetAbsolutePosition(x, y int)

func (Window) SetAlwaysOnTop

func (w Window) SetAlwaysOnTop(b bool) application.Window

func (Window) SetBackgroundColour

func (w Window) SetBackgroundColour(colour application.RGBA) application.Window

func (Window) SetFrameless

func (w Window) SetFrameless(frameless bool) application.Window

func (Window) SetFullscreenButtonEnabled

func (w Window) SetFullscreenButtonEnabled(enabled bool) application.Window

func (Window) SetHTML

func (w Window) SetHTML(html string) application.Window

func (Window) SetMaxSize

func (w Window) SetMaxSize(maxWidth, maxHeight int) application.Window

func (Window) SetMinSize

func (w Window) SetMinSize(minWidth, minHeight int) application.Window

func (Window) SetRelativePosition

func (w Window) SetRelativePosition(x, y int) application.Window

func (Window) SetResizable

func (w Window) SetResizable(b bool) application.Window

func (Window) SetSize

func (w Window) SetSize(width, height int) application.Window

func (Window) SetTitle

func (w Window) SetTitle(title string) application.Window

func (Window) SetURL

func (w Window) SetURL(s string) application.Window

func (Window) SetZoom

func (w Window) SetZoom(magnification float64) application.Window

func (Window) Show

func (w Window) Show() application.Window

func (Window) Size

func (w Window) Size() (width int, height int)

func (Window) ToggleDevTools

func (w Window) ToggleDevTools()

func (Window) ToggleFullscreen

func (w Window) ToggleFullscreen()

func (Window) UnFullscreen

func (w Window) UnFullscreen()

func (Window) UnMaximise

func (w Window) UnMaximise()

func (Window) UnMinimise

func (w Window) UnMinimise()

func (Window) Width

func (w Window) Width() int

func (Window) Zoom

func (w Window) Zoom()

func (Window) ZoomIn

func (w Window) ZoomIn()

func (Window) ZoomOut

func (w Window) ZoomOut()

func (Window) ZoomReset

func (w Window) ZoomReset() application.Window

Jump to

Keyboard shortcuts

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