websocket

package
v0.0.0-...-4f83aec Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2016 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const CLIENT_ALREADY_EXISTS = 10
View Source
const INVALID_NAME = 20
View Source
const SERVER_ERROR = 50
View Source
const TEXT_MESSAGE = 1
View Source
const USER_NAME_PWRD_DONT_MATCH = 21

Variables

View Source
var ERR_NOT_LOGIN = errors.New("You are not logged in.")

Functions

func Login

func Login(socket Socket, options *Options, cmd *Input) bool

func Register

func Register(socket Socket, options *Options, cmd *Input)

func Start

func Start(socket Socket, options *Options)

Types

type Connection

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

func New

func New(client connections.Client, socket Socket) *Connection

func NewWithNewClient

func NewWithNewClient(factory connections.ClientFactory, name string, socket Socket) *Connection

func (*Connection) Close

func (con *Connection) Close()

func (*Connection) HandleCommand

func (c *Connection) HandleCommand(cmd *Input) connections.Response

func (*Connection) SendMessage

func (con *Connection) SendMessage(m message.Message)

type Input

type Input struct {
	Command string
	Args    []string
}

type Message

type Message struct {
	Type    string
	Success bool
	Code    int
	String  string
	Data    interface{}
}

type Options

type Options struct {
	RoomList      *room.RoomList
	ChatLog       io.Writer
	DataFactory   clientdata.Factory
	ClientFactory connections.ClientFactory
}

type Socket

type Socket interface {
	Close() error
	ReadMessage() (messageType int, p []byte, err error)
	WriteMessage(messageType int, p []byte) (err error)
}

Jump to

Keyboard shortcuts

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