socket

package
v0.0.0-...-55d16bb Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitHttpHandlers

func InitHttpHandlers()

func OnNewSocketConnection

func OnNewSocketConnection(f func(Socket))

Types

type AjaxSocket

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

func NewAjaxSocket

func NewAjaxSocket() *AjaxSocket

func (*AjaxSocket) Close

func (a *AjaxSocket) Close()

func (*AjaxSocket) IsClosed

func (a *AjaxSocket) IsClosed() bool

func (*AjaxSocket) OnClose

func (a *AjaxSocket) OnClose(f func())

func (*AjaxSocket) OnRead

func (a *AjaxSocket) OnRead(f func(string))

func (*AjaxSocket) RemoteAddr

func (a *AjaxSocket) RemoteAddr() string

func (*AjaxSocket) Type

func (a *AjaxSocket) Type() SocketType

func (*AjaxSocket) UserAgent

func (a *AjaxSocket) UserAgent() string

func (*AjaxSocket) Write

func (a *AjaxSocket) Write(data string)

type DummySocket

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

func NewSocketDummy

func NewSocketDummy(remoteAddr string, userAgent string) *DummySocket

func (*DummySocket) Close

func (s *DummySocket) Close()

func (*DummySocket) IsClosed

func (s *DummySocket) IsClosed() bool

func (*DummySocket) OnClose

func (s *DummySocket) OnClose(f func())

func (*DummySocket) OnRead

func (s *DummySocket) OnRead(func(string))

func (*DummySocket) RemoteAddr

func (s *DummySocket) RemoteAddr() string

func (*DummySocket) Type

func (s *DummySocket) Type() SocketType

func (*DummySocket) UserAgent

func (s *DummySocket) UserAgent() string

func (*DummySocket) Write

func (s *DummySocket) Write(string)

type Socket

type Socket interface {
	Type() SocketType
	RemoteAddr() string
	UserAgent() string

	Close()
	IsClosed() bool
	OnClose(func())

	Write(data string)
	OnRead(func(data string))
}

type SocketType

type SocketType int
const (
	// The socket types
	TypeDummySocket SocketType = 1 << iota
	TypeAjaxSocket  SocketType = 1 << iota
	TypeWebSocket   SocketType = 1 << iota
)

type WebSocket

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

func NewWebSocket

func NewWebSocket() *WebSocket

func (*WebSocket) Close

func (w *WebSocket) Close()

func (*WebSocket) IsClosed

func (w *WebSocket) IsClosed() bool

func (*WebSocket) OnClose

func (w *WebSocket) OnClose(f func())

func (*WebSocket) OnRead

func (w *WebSocket) OnRead(f func(string))

func (*WebSocket) RemoteAddr

func (w *WebSocket) RemoteAddr() string

func (*WebSocket) Type

func (w *WebSocket) Type() SocketType

func (*WebSocket) UserAgent

func (w *WebSocket) UserAgent() string

func (*WebSocket) Write

func (w *WebSocket) Write(data string)

Write sends the data to the client

Jump to

Keyboard shortcuts

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