ws

package
v0.0.0-...-c4cb933 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EngineIoOpen    = "0"
	EngineIoClose   = "1"
	EngineIoPing    = "2"
	EngineIoPong    = "3"
	EngineIoMessage = "4"

	SocketIoConnect     = "0"
	SocketIoDisconnect  = "1"
	SocketIoEvent       = "2"
	SocketIoAck         = "3"
	SocketIoError       = "4"
	SocketIoBinaryEvent = "5"
	SocketIoBinaryAck   = "6"
)

Socket.io standard packet types

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client represents a Socket.io websocket connection wrapper for Syncoboard's WebRTC signaling

func NewClient

func NewClient(websocketUrl string) *Client

NewClient creates a new WebSocket client websocketUrl should be the base URL to the websocket server, e.g., "ws://localhost:3002"

func (*Client) Close

func (c *Client) Close()

Close gracefully closes the websocket connection

func (*Client) Connect

func (c *Client) Connect() error

Connect establishes the Socket.io connection and starts the read loop

func (*Client) JoinVoice

func (c *Client) JoinVoice(boardId, peerId string) error

JoinVoice Call a specific board's voice channel

func (*Client) LeaveVoice

func (c *Client) LeaveVoice(boardId, peerId string) error

LeaveVoice Leaves a specific board's voice channel

func (*Client) OnVoiceJoin

func (c *Client) OnVoiceJoin(callback func(peerId string))

OnVoiceJoin Registers a callback for when a peer joins the board's voice channel

func (*Client) OnVoiceLeave

func (c *Client) OnVoiceLeave(callback func(peerId string))

OnVoiceLeave Registers a callback for when a peer leaves the board's voice channel

func (*Client) OnVoiceSignal

func (c *Client) OnVoiceSignal(callback func(fromPeerId string, signal map[string]interface{}))

OnVoiceSignal Registers a callback for receiving WebRTC signals from other peers

func (*Client) SendSignal

func (c *Client) SendSignal(toPeerId, fromPeerId string, signal map[string]interface{}) error

SendSignal Sends a WebRTC signal to a specific peer

Jump to

Keyboard shortcuts

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