stream

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2018 License: MIT Imports: 9 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

The API provides a handler for a WebSocket stream API.

func New

func New(pingPeriod, pongTimeout time.Duration) *API

New creates a new instance of API. pingPeriod: is the interval, in which is server sends the a ping to the client. pongTimeout: is the duration after the connection will be terminated, when the client does not respond with the pong command.

func (*API) Close

func (a *API) Close()

Close closes all client connections and stops answering new connections.

func (*API) Handle

func (a *API) Handle(ctx *gin.Context)

Handle handles incoming requests. First it upgrades the protocol to the WebSocket protocol and then starts listening for read and writes.

func (*API) Notify

func (a *API) Notify(userID uint, msg *model.Message)

Notify notifies the clients with the given userID that a new messages was created.

Jump to

Keyboard shortcuts

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