popapi

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APIVersion = 1

	CmdPingRequest  = "popapi-ping-request"
	CmdPingResponse = "popapi-ping-response"

	CmdL2KeystoneNotification = "popapi-notification"
)

Variables

View Source
var (
	APIVersionRoute = fmt.Sprintf("v%d", APIVersion)
	RouteWebsocket  = fmt.Sprintf("/%s/ws", APIVersionRoute)

	DefaultListen = "localhost:31337"
	DefaultURL    = fmt.Sprintf("ws://%s/%s", DefaultListen, RouteWebsocket)
)

Functions

func APICommands

func APICommands() map[protocol.Command]reflect.Type

func Call

func Call(ctx context.Context, c *protocol.Conn, payload any) (protocol.Command, string, any, error)

Call is a blocking call. One should use ReadConn when using Call or else the completion will end up in the Read instead of being completed as expected.

func Read

Read is the low level primitive of a protocol Read. One should generally not use this function and use ReadConn instead.

func ReadConn

func ReadConn(ctx context.Context, c *protocol.Conn) (protocol.Command, string, any, error)

ReadConn reads from Conn and performs callbacks. One should use ReadConn over Read when mixing Write, WriteConn and Call.

func Write

func Write(ctx context.Context, c protocol.APIConn, id string, payload any) error

Write is the low level primitive of a protocol Write. One should generally not use this function and use WriteConn and Call instead.

func WriteConn

func WriteConn(ctx context.Context, c *protocol.Conn, id string, payload any) error

WriteConn writes to Conn. It is equivalent to Write but exists for symmetry reasons.

Types

type L2KeystoneNotfication

type L2KeystoneNotfication struct{}

type PingRequest

type PingRequest protocol.PingRequest

type PingResponse

type PingResponse protocol.PingResponse

Jump to

Keyboard shortcuts

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