server

package
v0.0.0-...-12eefb5 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package server contains types for connecting to/creating the gRPC server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

The Client type is used to communicate with the voip server.

func Dial

func Dial(ctx context.Context, user, pass, addr string) (*Client, error)

Dial the targeted voip server and return a new client instance. Returns an error if the connection fails.

func (*Client) Close

func (c *Client) Close() error

Close the connection with the server.

func (*Client) JoinChannel

func (c *Client) JoinChannel(ctx context.Context, name string) error

JoinChannel makes a request to the server to join/move the current client to a different channel. This will start/restart the audio stream,

func (*Client) Read

func (c *Client) Read(p []byte) (n int, err error)

func (*Client) Write

func (c *Client) Write(p []byte) (n int, err error)

type Server

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

The Server type is responsible for running the gRPC server and registering gRPC services.

func New

func New(services []Service, opts ...grpc.ServerOption) *Server

New creates a new server instance and registers the provided services against it.

func (*Server) Run

func (g *Server) Run(ctx context.Context) error

Run the server, the server will stop serving when the provided context is cancelled.

type Service

type Service interface {
	Register(svr *grpc.Server)
}

The Service type represents a gRPC service than can handle rpc calls sent to the server.

Jump to

Keyboard shortcuts

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