Categorygithub.com/talkfun/go-engine.io
modulepackage
1.4.5
Repository: https://github.com/talkfun/go-engine.io.git
Documentation: pkg.go.dev

# README

go-engine.io

GoDoc Build Status Coverage Status

go-engine.io is the implement of engine.io in golang, which is transport-based cross-browser/cross-device bi-directional communication layer for go-socket.io.

It is compatible with node.js implement, and supported long-polling and websocket transport.

Install

Install the package with:

go get github.com/talkfun/go-engine.io@v1

Import it with:

import "github.com/talkfun/go-engine.io"

and use engineio as the package name inside the code.

Example

Please check example folder for details.

package main

import (
	"encoding/hex"
	"io/ioutil"
	"log"
	"net/http"

	"github.com/talkfun/go-engine.io"
)

func main() {
	server, _ := engineio.NewServer(nil)

	go func() {
		for {
			conn, _ := server.Accept()
			go func() {
				defer conn.Close()
				for {
					t, r, _ := conn.NextReader()
					b, _ := ioutil.ReadAll(r)
					r.Close()

					w, _ := conn.NextWriter(t)
					w.Write(b)
					w.Close()
				}
			}()
		}
	}()

	http.Handle("/engine.io/", server)
	log.Println("Serving at localhost:5000...")
	log.Fatal(http.ListenAndServe(":5000", nil))
}

License

The 3-clause BSD License - see LICENSE for more details

# Packages

No description provided by the author
No description provided by the author
Package packet is codec of packet for connection which supports framing.
No description provided by the author
No description provided by the author

# Functions

NewServer returns a server.

# Constants

BINARY is binary type message.
PING is ping type message.
TEXT is text type message.

# Structs

Dialer is dialer configure.
Options is options to create a server.
Server is server.

# Interfaces

Conn is connection.
SessionIDGenerator generates new session id.

# Type aliases

FrameType is type of a message frame.