websocket

package
Version: v0.0.0-...-402a30c Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package websocket implements websocket communication with the aria2 daemon

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAdapter

func NewAdapter(address, secret string) (a rpc.Adapter, err error)

NewAdapter creates a Caller with the websocket.DefaultDialer

func NewClient

func NewClient(address, secret string) (argo.Client, error)

NewClient creates a Client with the http.DefaultClient

Types

type Emitter

type Emitter struct {
	*Websocket
}

Emitter allows to receive notifications from an URL

func NewEmitter

func NewEmitter(add string) (j *Emitter, err error)

NewEmitter creates a NotificationEmitter with the websocket.DefaultDialer

func (Emitter) Emit

func (j Emitter) Emit() (notif argo.Notification, err error)

Emit a notification (as soon as one is read via websocket)

type Poster

type Poster struct {
	*Websocket
}

Poster allows to send rpc.Request via Websocket

func NewPoster

func NewPoster(add string) (j *Poster, err error)

NewPoster creates a Poster with the websocket.DefaultDialer

func (Poster) Post

func (j Poster) Post(v rpc.Request) (reply rpc.Response, err error)

Post performs the Request

type Websocket

type Websocket struct {
	Conn      *websocket.Conn
	WriteWait time.Duration
}

Websocket represent a closable websocket connection

func NewWebsocket

func NewWebsocket(add string) (w *Websocket, err error)

NewWebsocket creates a closable websocket with the websocket.DefaultDialer

func (*Websocket) Close

func (w *Websocket) Close() (err error)

Close gracefully closes the connection (with a CloseMessage)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL