engineio

package module
v0.0.0-...-e67ce1c Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2014 License: MIT Imports: 13 Imported by: 0

README

engineio

engine.io in Go.

Status

Under active developement.

Highlights

  • Compatible with the latest engine.io version
  • Tested with the original test suites
  • Robust salability

How to use

Check this link for the document of the original engine.io.

API

TODO: Add golang style api document.

Development

Get the repository by:

export GOPATH=/your/workspace
mkdir -p $GOPATH
cd $GOPATH
go get github.com/kaicheng/engineio

The source tree will be located at $GOPATH/src/github.com/kaicheng/engineio.

For testings, you need more dependencies:

cd $GOPATH/src/github.com/kaicheng/engineio/test
npm install

Tests

cd $GOPATH/src/github.com/kaicheng/engineio/test
npm install
cd $GOPATH/src/github.com/kaicheng/engineio
make test

It test the server with engine.io-client.

Contribution

Documentation

Index

Constants

View Source
const (
	UNKNOWN_TRANSPORT int = iota
	UNKNOWN_SID
	BAD_HANDSHAKE_METHOD
	BAD_REQUEST
)

Variables

View Source
var ErrorMessages = []string{"Transport unknown", "Session ID unknown", "Bad handshake method", "Bad request"}
View Source
var Protocol int = 1

Functions

This section is empty.

Types

type Error

type Error struct {
	Msg  string
	Type string
	Desc string
}

func (*Error) Error

func (err *Error) Error() string

type JSONP

type JSONP struct {
	Polling
	// contains filtered or unexported fields
}

func (*JSONP) InitJSONP

func (jsonp *JSONP) InitJSONP(req *Request)

type Options

type Options map[string]interface{}

type Polling

type Polling struct {
	TransportBase
	// contains filtered or unexported fields
}

func (*Polling) InitPolling

func (poll *Polling) InitPolling(req *Request)

type Request

type Request struct {
	events.EventEmitter

	Query url.Values
	// contains filtered or unexported fields
}

type Server

type Server struct {
	events.EventEmitter

	Clients map[string]*Socket
	// contains filtered or unexported fields
}

func Attach

func Attach(server *http.Server, opts Options) *Server

func Listen

func Listen(port int, opts Options) *Server

func NewServer

func NewServer(opts Options) (srv *Server)

func (*Server) Close

func (srv *Server) Close()

func (*Server) ServeHTTP

func (srv *Server) ServeHTTP(res http.ResponseWriter, httpreq *http.Request)

type Socket

type Socket struct {
	events.EventEmitter

	Request   *Request
	Transport Transport
	// contains filtered or unexported fields
}

func (*Socket) Close

func (socket *Socket) Close()

func (*Socket) OnError

func (socket *Socket) OnError(err string)

func (*Socket) Send

func (socket *Socket) Send(data []byte)

func (*Socket) SendBin

func (socket *Socket) SendBin(data []byte)

func (*Socket) SetWriteBuffer

func (socket *Socket) SetWriteBuffer(buf []*parser.Packet)

func (*Socket) Write

func (socket *Socket) Write(data []byte)

func (*Socket) WriteBuffer

func (socket *Socket) WriteBuffer() []*parser.Packet

type Transport

type Transport interface {
	events.EventEmitterInt

	Name() string
	// contains filtered or unexported methods
}

func NewPollingTransport

func NewPollingTransport(req *Request) Transport

func NewWebSocketTransport

func NewWebSocketTransport(req *Request) Transport

type TransportBase

type TransportBase struct {
	events.EventEmitter
	// contains filtered or unexported fields
}

func (*TransportBase) Name

func (trans *TransportBase) Name() string

type WebSocket

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

func (*WebSocket) InitWebSocket

func (ws *WebSocket) InitWebSocket(req *Request)

type XHR

type XHR struct {
	Polling
}

func (*XHR) InitXHR

func (xhr *XHR) InitXHR(req *Request)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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