notice

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Copyright 2016 Wenhui Shen <www.webx.top>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016 Wenhui Shen <www.webx.top>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	Succeed         = 1
	Failed          = 0
	Unauthenticated = -1
	Forbid          = -2
)

Variables

View Source
var DefaultUserNotices = NewUserNotices()

Functions

func Clear

func Clear()

func CloseClient

func CloseClient(user string) bool

func CloseMessage

func CloseMessage(user string, types ...string)

func NewUserNotices

func NewUserNotices() *userNotices

func OpenClient

func OpenClient(user string)

func OpenMessage

func OpenMessage(user string, types ...string)

func Recv

func Recv(user string) <-chan *Message

func RecvJSON

func RecvJSON(user string) []byte

func RecvXML

func RecvXML(user string) []byte

func Send

func Send(user string, message *Message)

func Stdout

func Stdout(message *Message)

Types

type Message

type Message struct {
	Type    string      `json:"type" xml:"type"`
	Title   string      `json:"title" xml:"title"`
	Status  int         `json:"status" xml:"status"`
	Content interface{} `json:"content" xml:"content"`
}

func NewMessage

func NewMessage() *Message

func NewMessageWithValue

func NewMessageWithValue(typ string, title string, content interface{}, status ...int) *Message

type Notice

type Notice struct {
	Types   map[string]bool
	Message chan *Message `json:"-" xml:"-"`
}

func NewNotice

func NewNotice() *Notice

type OnlineUser

type OnlineUser struct {
	Notice  *Notice
	Clients uint
}

func NewOnlineUser

func NewOnlineUser() *OnlineUser

Jump to

Keyboard shortcuts

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