wrpcnet

package
v0.0.0-...-0b38cba Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Pipe

func Pipe() (*MessagePort, *MessagePort)

Pipe returns a synchronous duplex MessagePort pipe.

Types

type MessagePort

type MessagePort struct {
	Value js.Value
	// contains filtered or unexported fields
}

MessagePort is a synchronous JS MessagePort wrapper.

func NewMessagePort

func NewMessagePort(value js.Value) *MessagePort

NewMessagePort creates a synchronous JS MessagePort wrapper.

func (*MessagePort) Close

func (p *MessagePort) Close() error

Close the port. All pending reads and writes are unblocked and return io.ErrClosedPipe.

func (*MessagePort) CloseWithError

func (p *MessagePort) CloseWithError(err error)

CloseWithError writes an error message into the port and closes the port. All pending reads and writes are unblocked and return io.ErrClosedPipe.

func (*MessagePort) Read

func (p *MessagePort) Read(b []byte) (n int, err error)

Read a byte array message from the port.

func (*MessagePort) ReadMessage

func (p *MessagePort) ReadMessage() (js.Value, error)

ReadMessage reads a single message or error from the port.

func (*MessagePort) Write

func (p *MessagePort) Write(b []byte) (n int, err error)

Write a byte array message into the port.

func (*MessagePort) WriteMessage

func (p *MessagePort) WriteMessage(messages map[string]any, transferables []any) error

WriteMessage writes a messages into the port. It blocks until the remote side reads the message.

Jump to

Keyboard shortcuts

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