event

package
v0.0.44 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2016 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

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 (
	WRITE_WAIT       = 10 * time.Second
	PONG_WAIT        = 60 * time.Second
	PING_PERIOD      = (PONG_WAIT * 9) / 10
	MAX_MESSAGE_SIZE = 1024 * 1024
)

Let's focus on Client code now

Variables

This section is empty.

Functions

func InitBroadcaster

func InitBroadcaster()

Initialized Broadcast variable

func RouteEvent

func RouteEvent(event models.NodeEvent)

func ServeWs

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

serveWs handles websocket requests from the peer.

func StartBroadcaster

func StartBroadcaster(websocketPort string, ssl bool, sslParams map[string]string)

Start event broadcaster

func StartListener

func StartListener(eventSocket string)

Types

type EventBroadcaster

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

Centralized architecture: A central EventBroadcaster is going to receive all ingoing events and to broadcast them to each connected Client

var (
	Broadcaster EventBroadcaster
)

func GetBroadcaster

func GetBroadcaster() *EventBroadcaster

Getter for Broadcast variable

func (*EventBroadcaster) Run

func (Broadcaster *EventBroadcaster) Run()

At the end, we instantiate our EventBroadcaster

type Listener

type Listener int

func (*Listener) PersistNodeEvent

func (l *Listener) PersistNodeEvent(args *models.NodeEvent, ack *bool) error

func (*Listener) PushEvent

func (l *Listener) PushEvent(line string, ack *bool) error

func (*Listener) PushNodeStartEvent

func (l *Listener) PushNodeStartEvent(args *NodeStartEventArgs, ack *bool) error

func (*Listener) PushUnManagedNode

func (l *Listener) PushUnManagedNode(args *NodeStartEventArgs, ack *bool) error

type NodeStartEventArgs

type NodeStartEventArgs struct {
	Timestamp time.Time `json:"timestamp"`
	Node      string    `json:"node"`
}

Jump to

Keyboard shortcuts

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