kickService

package
v0.0.0-...-b4d25fc Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KickUser

func KickUser(appId string, channel string, userId string, duration int, restToken string) error

KickUser calls the Agora API to ban a user from a channel.

It takes in the app ID, channel name, user ID, ban duration in seconds, and Agora REST API token.

The ban removes the "join_channel" privilege from the user for the specified duration.

Returns any error encountered, or nil if successful.

Types

type ActiveFenceReq

type ActiveFenceReq struct {
	UID      string `json:"userId"`
	Metadata string `json:"metadata"`
}

type ReqMetadata

type ReqMetadata struct {
	Cname string `json:"cname"`
	UID   int    `json:"uid"`
}

type Service

type Service struct {
	Server *http.Server
	Sigint chan os.Signal
	// contains filtered or unexported fields
}

Service is the backend service

func NewService

func NewService() *Service

func (*Service) KickHandler

func (s *Service) KickHandler(w http.ResponseWriter, r *http.Request)

KickHandler handles incoming moderation kick requests from ActiveFence. It parses the request, calls the Agora API to ban the user, and returns the response.

func (*Service) Start

func (s *Service) Start()

Start runs the service by listening to the specified port

func (*Service) Stop

func (s *Service) Stop()

Stop service safely, closing additional connections if needed.

Jump to

Keyboard shortcuts

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