chat

package
v0.0.0-...-915fa77 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2022 License: BSD-2-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package chat defines the various message handlers and network objects used in the test chat server and client applications.

---------------------------------------------------------------------------

msgMsg.go

This file is auto-generated by the net message code generator and should
NOT be edited by hand unless you know what you are doing. Changes to the
source object definition will be automatically reflected in the this
generated code the next time genproc is run.

-----------

Index

Constants

View Source
const (
	MSG_SUB_CHAT = iota
	MSG_SUB_CMD
	MSG_SUB_CONNECT
	MSG_SUB_JOIN_CHANNEL
	MSG_SUB_LEAVE_CHANNEL
	MSG_SUB_SET_NAME
)

Msg subtypes

View Source
const CHAT_MOD_NAME = "Chat"

Chat module name.

View Source
const CHAT_MSG_SEND_TIMEOUT_SEC = 5

Timeout value for sends.

View Source
const (
	PUB_CHANNEL = "public"
)

Channel constants.

Variables

This section is empty.

Functions

This section is empty.

Types

type Msg

type Msg struct {
	Access    byte
	ChannelId uint32 // +export+
	From      string // +export+
	FromId    uint32
	Subtype   byte   // +export+
	Text      string // +export+
}
+NetMsg+ proto.CHAT_MSG

Msg represents a message sent from one client to the chat system. ChannelId is the channel that the message is being sent to. From is the friendly name of the user sending the message. FromId is the NetID of the message sender. Subtype denotes the type of chat message being sent. ToID is the NetID of the message recipient. Text is the actual text of the message.

type MsgHandler

type MsgHandler struct{}

MsgHandler is an empty function container.

func (*MsgHandler) Close

func (this *MsgHandler) Close()

Close is called when a message signature is unregistered from a protocol.

func (*MsgHandler) DeserializeMsg

func (this *MsgHandler) DeserializeMsg(msg *net.Msg, access byte) (interface{}, error)

DeserializeMsg is called by the protocol after an incoming network message has been validated, decrypted, and uncompressed.

func (*MsgHandler) Init

func (this *MsgHandler) Init(proto *net.Protocol)

Init is called when the message signature is first registered in a protocol.

func (*MsgHandler) SerializeMsg

func (this *MsgHandler) SerializeMsg(data interface{}) (*net.Msg, error)

SerializeMsg is called by the protocol after a Msg object has been validated, compressed, and encrypted, in order to prepare a network message for transmission.

func (*MsgHandler) Signature

func (this *MsgHandler) Signature() uint16

Signature returns Msg's network signature (proto.CHAT_MSG).

Jump to

Keyboard shortcuts

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