msg

package
v0.0.0-...-e676b46 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package msg contains the RMX message types for communication between clients.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectMsg

type ConnectMsg struct {
	UserID   uuid.UUID `json:"userId"`
	UserName string    `json:"userName"`
}

type Envelope

type Envelope struct {
	// Message identifier
	ID uuid.UUID `json:"id"`
	// TextMsg | MIDIMsg | ConnectMsg
	Typ MsgType `json:"type"`
	// RMX client identifier
	UserID uuid.UUID `json:"userId"`
	// Actual message data.
	Payload json.RawMessage `json:"payload"`
}

func (*Envelope) SetPayload

func (e *Envelope) SetPayload(payload any) error

func (*Envelope) Unwrap

func (e *Envelope) Unwrap(msg any) error

type MIDIMsg

type MIDIMsg struct {
	State NoteState `json:"state"`
	// MIDI Note # in "C3 Convention", C3 = 60. Available values: (0-127)
	Number int `json:"number"`
	// MIDI Velocity (0-127)
	Velocity int `json:"velocity"`
}

type MsgType

type MsgType int
const (
	TEXT MsgType = iota
	MIDI
	CONNECT
)

type NoteState

type NoteState int
const (
	NOTE_OFF NoteState = iota
	NOTE_ON
)

type TextMsg

type TextMsg struct {
	DisplayName string `json:"displayName"`
	Body        string `json:"body"`
}

Jump to

Keyboard shortcuts

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