channel

package
v0.0.0-...-10dce8e Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2025 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package channal 基于redis实现聊天室

Index

Constants

This section is empty.

Variables

View Source
var C = New()

Functions

This section is empty.

Types

type Channel

type Channel interface {
	// CreateRoom 创建一个聊天室
	CreateRoom(name string) bool
	// EnterRoom 进入聊天室
	EnterRoom(roonname string, expire time.Duration) (id string)
	// SetIdExpire 设置id的过期时间为当前时间经过一定时期
	SetIdExpire(roomname, id string, expire time.Duration)
	// ExitRoom 退出聊天室
	ExitRoom(roomname, id string)
	// GetInfo 获取聊天室的信息
	GetInfo(roomname string, id string) (history []string, ttl time.Duration, exist bool, online int64)
	// Init 进行连接数据库之类的初始化
	Init()
	// SendMessage 发送一条消息到聊天室
	SendMessage(roomname string, message string) bool
	// contains filtered or unexported methods
}

Channel 管理多个聊天室

func New

func New() Channel

Jump to

Keyboard shortcuts

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