websocket

package
Version: v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2016 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package websocket manages websocket connections and notifications for Abot clients. This is used by github.com/itsabot/plugin_training to notify trainers of new user messages without requiring page reload.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AtomicWebSocketSet

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

AtomicWebSocketSet maintains open websocket connections with up to one available per user. The uint64 key within the map represents the userID to whom the connection belongs.

func NewAtomicWebSocketSet

func NewAtomicWebSocketSet() AtomicWebSocketSet

NewAtomicWebSocketSet returns an AtomicWebSocketSet to maintain open WebSocket connections on a per-user basis.

func (AtomicWebSocketSet) Get

func (as AtomicWebSocketSet) Get(userID uint64) *websocket.Conn

Get returns a WebSocket connection for a given userID in a thread-safe way.

func (AtomicWebSocketSet) NotifySockets

func (as AtomicWebSocketSet) NotifySockets(uid uint64, cmd, ret string) error

NotifySockets sends listening clients new messages over WebSockets, eliminating the need for trainers to constantly reload the page.

func (AtomicWebSocketSet) Set

func (as AtomicWebSocketSet) Set(userID uint64, conn *websocket.Conn)

Set a WebSocket connection for a given userID in a thread-safe way.

Source Files

Jump to

Keyboard shortcuts

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