server

package
v0.0.0-...-6f4ec31 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2019 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const DEFAULT_VERSION = 1
View Source
const MSG_HEADER_SIZE = 12
View Source
const PLATFORM_ANDROID = 2
View Source
const PLATFORM_IOS = 1

平台号

View Source
const PLATFORM_WEB = 3

Variables

This section is empty.

Functions

func CheckOrigin

func CheckOrigin(r *http.Request) bool

func DequeueMessage

func DequeueMessage(w http.ResponseWriter, req *http.Request)

func GetLatestMessageInterface

func GetLatestMessageInterface(addr string, r *model.HistoryRequest) []*model.HistoryMessage

func GetNewCountInterface

func GetNewCountInterface(addr string, s *model.SyncHistory) (int64, error)

获取是否接收到新消息,只会返回0/1

func GetOfflineCount

func GetOfflineCount(w http.ResponseWriter, req *http.Request)

func InitHttpServer

func InitHttpServer()

func InitMessageQueue

func InitMessageQueue(w http.ResponseWriter, req *http.Request)

func Listen

func Listen(port int)

func ListenClient

func ListenClient()

func ListenRPCClient

func ListenRPCClient()

func ListenSSL

func ListenSSL(port int, cert_file, key_file string)

func LoadHistoryMessage

func LoadHistoryMessage(w http.ResponseWriter, req *http.Request)

func LoadLatestMessage

func LoadLatestMessage(w http.ResponseWriter, req *http.Request)

func PostGroupNotification

func PostGroupNotification(w http.ResponseWriter, req *http.Request)

http

func PostIMMessage

func PostIMMessage(w http.ResponseWriter, req *http.Request)

func ReadHeader

func ReadHeader(buff []byte) (int, int, int, int, int)

func ReceiveClientMessage

func ReceiveClientMessage(conn io.Reader) *CommonModel.Message

接受客户端消息(external messages)

func ReceiveLimitMessage

func ReceiveLimitMessage(conn io.Reader, limit_size int, external bool) *CommonModel.Message

func ReceiveMessage

func ReceiveMessage(conn io.Reader) *CommonModel.Message

func ReceiveStorageSyncMessage

func ReceiveStorageSyncMessage(conn io.Reader) *CommonModel.Message

消息大小限制在1M

func SaveGroupMessageInterface

func SaveGroupMessageInterface(addr string, m *model.GroupMessage) (int64, error)

func SavePeerMessageInterface

func SavePeerMessageInterface(addr string, m *model.PeerMessage) (int64, error)

func SendCustomerMessage

func SendCustomerMessage(w http.ResponseWriter, req *http.Request)

func SendCustomerSupportMessage

func SendCustomerSupportMessage(w http.ResponseWriter, req *http.Request)

func SendGroupIMMessage

func SendGroupIMMessage(im *CommonModel.IMMessage, appid int64)

func SendGroupNotification

func SendGroupNotification(appid int64, gid int64,
	notification string, members CommonModel.IntSet)

func SendIMMessage

func SendIMMessage(im *CommonModel.IMMessage, appid int64)

func SendMessage

func SendMessage(conn io.Writer, msg *CommonModel.Message) error

func SendNotification

func SendNotification(w http.ResponseWriter, req *http.Request)

func SendRealtimeMessage

func SendRealtimeMessage(w http.ResponseWriter, req *http.Request)

func SendRoomMessage

func SendRoomMessage(w http.ResponseWriter, req *http.Request)

func SendSystemMessage

func SendSystemMessage(w http.ResponseWriter, req *http.Request)

func ServeWebsocket

func ServeWebsocket(w http.ResponseWriter, r *http.Request)

func Stack

func Stack(rw http.ResponseWriter, req *http.Request)

func StartHttpServer

func StartHttpServer(addr string)

func StartSocketIO

func StartSocketIO(address string, tls_address string,
	cert_file string, key_file string)

func StartWSServer

func StartWSServer(address string, tls_address string, cert_file string, key_file string)

func Summary

func Summary(rw http.ResponseWriter, req *http.Request)

func SyncGroupMessageInterface

func SyncGroupMessageInterface(addr string, sync_key *model.SyncGroupHistory) *model.GroupHistoryMessage

func SyncMessageInterface

func SyncMessageInterface(addr string, sync_key *model.SyncHistory) *model.PeerHistoryMessage

func WriteHeader

func WriteHeader(len int32, seq int32, cmd byte, version byte, flag byte, buffer io.Writer)

func WriteHttpError

func WriteHttpError(status int, err string, w http.ResponseWriter)

func WriteHttpObj

func WriteHttpObj(data map[string]interface{}, w http.ResponseWriter)

func WriteMessage

func WriteMessage(w *bytes.Buffer, msg *CommonModel.Message)

Types

type MessageCreator

type MessageCreator func() CommonModel.IMessage

type SIOServer

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

func (*SIOServer) ServeHTTP

func (s *SIOServer) ServeHTTP(w http.ResponseWriter, req *http.Request)

type VersionMessageCreator

type VersionMessageCreator func() CommonModel.IVersionMessage

Jump to

Keyboard shortcuts

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