signal

package
v0.0.0-...-e5ecada Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

signal is an internal pkg of quikface that implements simple signal server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(in string, obj interface{}, decompress bool) error

Decode decodes the input from base64 It can optionally unzip the input after decoding

func Encode

func Encode(obj interface{}, compress bool) string

Encode encodes the input in base64 It can optionally zip the input before encoding

func MustReadStdin

func MustReadStdin() string

MustReadStdin blocks until input is received from stdin, and panics on error.

func Send

func Send(w io.Writer, data interface{}) error

func Unzip

func Unzip(in []byte) ([]byte, error)

func WSHandler

func WSHandler(w http.ResponseWriter, r *http.Request)

func Zip

func Zip(in []byte) ([]byte, error)

Types

type Message

type Message interface {
	Cmd() string // returns the signal command as string
	Send(w io.Writer, msg string) error
	String() string // returns the message string
}

type Signal

type Signal struct {
	UserId string // optional user id of client
	Data   []byte // webrtc SDP payload
}

func (*Signal) Cmd

func (sig *Signal) Cmd() string

func (*Signal) Send

func (sig *Signal) Send(w io.Writer, msg string) error

func (*Signal) String

func (sig *Signal) String() string

type WsClientMessage

type WsClientMessage struct {
	Command  string `json:"cmd"`
	ClientID string `json:"client_id"`
	Msg      string `json:"msg"`
	Type     string `json:"type"`
	SDP      string `json:"sdp,omitempty"`
	Name     string `json:"name,omitempty"`
}

websocket message from the client

func (WsClientMessage) Cmd

func (cm WsClientMessage) Cmd() string

func (WsClientMessage) Send

func (cm WsClientMessage) Send(w io.Writer, msg string) error

func (WsClientMessage) String

func (cm WsClientMessage) String() string

Jump to

Keyboard shortcuts

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