gos

package module
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2023 License: MIT Imports: 14 Imported by: 0

README

gos

Golang server

v1.1.0

  • 修正斷線重連 與 斷線,兩者過程中的資源釋放與變數重置
  • 允許透過傳遞 site(server id) 和 cid(連線 ID),將 A 伺服器的任務轉交給 B 伺服器處理,結束後再返還給 A 伺服器,並回覆客戶端

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bind

func Bind(serverId int32, ip string, port int, socketType define.SocketType, onEvents base.OnEventsFunc, introduction *[]byte, heartbeat *[]byte) (ask.IAsker, error)

向位置 ip:port 送出連線請求,利用 serverId 來識別多個連線 serverId: server id ip: server ip port: server port socketType: 協定類型

func CheckWorks

func CheckWorks(msg string, root *base.Work)

func Disconnect added in v1.4.0

func Disconnect(port int32, cid int32) error

func GetFrameTime added in v1.4.0

func GetFrameTime() time.Duration

func Listen

func Listen(socketType define.SocketType, port int32) (ans.IAnswer, error)

指定要監聽的 port,並生成 Anser 物件

func Run added in v1.4.0

func Run(run func())

func RunAns

func RunAns()

開始讀取數據與處理

func RunAsk

func RunAsk()

func SendRequest added in v1.1.0

func SendRequest(req *ghttp.Request, callback func(*ghttp.Context)) (int32, error)

傳送 http 訊息

func SendToClient

func SendToClient(port int32, cid int32, data *[]byte, length int32) error

func SendToServer

func SendToServer(serverId int32, data *[]byte, length int32) error

func SendTransDataToServer added in v1.2.3

func SendTransDataToServer(serverId int32, td *base.TransData) error

func SetFrameTime added in v1.4.0

func SetFrameTime(frameTime time.Duration)

func SetLogger added in v1.3.0

func SetLogger(lg *glog.Logger)

func StartConnect

func StartConnect() error

開始所有已註冊的監聽

func StartListen

func StartListen()

開始所有已註冊的監聽

Types

This section is empty.

Directories

Path Synopsis
example

Jump to

Keyboard shortcuts

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