cotillartc

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: BSD-2-Clause Imports: 15 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PionTransport

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

PionTransport is a DataChannel-only WebRTC transport running directly in the browser via syscall/js. It avoids linking pion/webrtc and its native network dependencies into the WebAssembly build.

func New

func New(self string, stunURLs []string, onData func(from string, data []byte)) *PionTransport

New creates a DataChannel-only WebRTC overlay transport for the local address self.

func (*PionTransport) AcceptAnswer

func (t *PionTransport) AcceptAnswer(peerAddr, answerSDP string) error

AcceptAnswer completes the handshake for an offered connection.

func (*PionTransport) AcceptOffer

func (t *PionTransport) AcceptOffer(peerAddr, offerSDP string) (string, error)

AcceptOffer handles an inbound offer from peerAddr and returns the local answer SDP.

func (*PionTransport) Broadcast

func (t *PionTransport) Broadcast(data []byte)

Broadcast delivers data to every open peer channel.

func (*PionTransport) Close

func (t *PionTransport) Close()

Close tears down all connections.

func (*PionTransport) ClosePeer

func (t *PionTransport) ClosePeer(addr string)

ClosePeer closes and cleans up an existing connection to addr.

func (*PionTransport) CreateOffer

func (t *PionTransport) CreateOffer(peerAddr string) (string, error)

CreateOffer starts a connection to peerAddr and returns the local SDP offer.

func (*PionTransport) HasActiveOrPending

func (t *PionTransport) HasActiveOrPending(addr string) bool

HasActiveOrPending returns true if addr currently has an open or in-progress connection.

func (*PionTransport) OnClose

func (t *PionTransport) OnClose(f func(addr string))

OnClose registers a callback fired when a peer's data channel or connection closes.

func (*PionTransport) OnOpen

func (t *PionTransport) OnOpen(f func(addr string))

OnOpen registers a callback fired when a peer's data channel opens.

func (*PionTransport) PeerTransceiverCount

func (t *PionTransport) PeerTransceiverCount(addr string) int

PeerTransceiverCount returns the number of RTP transceivers on the connection to addr. Primary overlay connections are strictly DataChannel-only (0 transceivers).

func (*PionTransport) Peers

func (t *PionTransport) Peers() []string

Peers returns addresses with an open data channel.

func (*PionTransport) Send

func (t *PionTransport) Send(addr string, data []byte) (err error)

Send delivers data to one peer over its data channel.

Jump to

Keyboard shortcuts

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